0
所以正如標題所說,當我使用verifyElement並通過ID搜索時,測試不會崩潰。但是當我嘗試輸入數據(特別是文本框)時,測試失敗。Selenium能夠驗證元素,無法訪問/使用這些元素
文本框:
<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,這也將失敗。
我出來的想法。
只需在firebug中驗證在同一個定位器中有多少個元素。 – Santoshsarma
不幸的是,我不能訪問除IE以外的任何頁面。 – thisisnotabus
:(。使用driver.findElements(By).size()來計算出在同一個定位器中有多少個元素。 – Santoshsarma