0

所以正如标题所说,当我使用 verifyElement 并按 ID 搜索时,测试不会崩溃。但是当我尝试输入数据(特别是输入文本框)时,测试失败了。

文本框:

<span><input type="text" name="searchString" maxlength="100" value="" id="searchString" class="commonTextBox"></span>

这不会失败:

automation.verifyElement(AutomationConstants.FIND_ID, "searchString", false);

这失败了:

automation.enterInputBox(AutomationConstants.FIND_XPATH, "//input[@id='searchString'and @class='commonTextBox']", "Alex", false);

我还使用了 FIND_ID 而不是 XPATH,这也失败了。

我没主意了。

4

2 回答 2

0
driver.findElement(By.xpath("//input[@id='searchString'and @class='commonTextBox']")).sendKeys("YOUR TEXT");
于 2013-04-03T13:53:41.813 回答
0

测试不会在验证时崩溃。您应该使用断言而不是验证。在这种情况下,您将确定该元素确实包含您需要的内容。

于 2013-04-03T11:57:37.693 回答