【发布时间】:2013-01-28 22:39:06
【问题描述】:
我正在使用 TestNG 运行 selenium RC 并填写注册页面。此页面包含姓名、电子邮件、密码等内容。
除了密码和确认密码字段外,所有字段都按照我的预期填写。这两个保持空白。我徒劳地搜索了几个论坛(包括这个)以寻求解决方案。
此论坛上的一篇帖子建议这样做: char[] 密码 = {'p','a','s','s','w','o','r','d'}; for(int i = 0; i
它的问题是它在 keyPress 上失败,因为预期的是 String,而不是 char。我想知道这是如何工作的。
这里是正在测试的源代码:
<input name="ctl00$ContentPlaceHolder1$EmailTextBox" type="text" maxlength="64" id="ctl00_ContentPlaceHolder1_EmailTextBox" class="tahname" />
<input name="ctl00$ContentPlaceHolder1$PasswordTextBox" type="password" maxlength="80" id="ctl00_ContentPlaceHolder1_PasswordTextBox" class="tahname" />
<input name="ctl00$ContentPlaceHolder1$ConfirmPasswordTextBox" type="password" id="ctl00_ContentPlaceHolder1_ConfirmPasswordTextBox" class="tahname" />
这是我的硒代码
selenium.type(emailLocator, "me@here.com");
selenium.type(passwordLocator, "password");
selenium.type(confirmPasswordLocator, "password");
我已经仔细检查了所有三个文本框的定位器。那里没问题。电子邮件文本框填写得很好。执行后密码和确认密码文本框为空白。 我确实注意到密码文本框类型=“密码”。我需要以不同的方式处理这些吗? 任何帮助将不胜感激。
【问题讨论】:
-
共享 HTML 代码或共享 URL(如果是打开的应用程序)。
-
Manigandan,我忘了把我的 html 用反引号括起来。现在应该可以查看了。
-
您的输入不是隐藏的,点击时可见吗?
标签: selenium passwords field selenium-rc