嗨我需要检查一个下拉字段有给定值,但这些值没有选择,所以它没有得到显示在下拉框中。 我具有以下的Xpath对元件Selenium.isElementPresent在Webdriver中的替代方法是什么
//table[contains(@id,'Field')]//tr[td//span[text()='Code']]/preceding-sibling::*[1]/td//select[contains(@id,'GSRCH_FLT')]/option[text()='not=']
被正确识别在浏览器中的元素。但是,当我使用以下webdriver方法来验证它
driver.findElement(By.xpath("//table[contains(@id,'Field')]//tr[td//span[text()='Code']]/preceding-sibling::*[1]/td//select[contains(@id,'GSRCH_FLT')]/option[text()='not=']")).isDisplayed();
它的返回false,因为它没有显示在框中。
你能告诉我这个选择吗?
如果您正在测试元素是否存在,为什么返回测试等于零? –
@MthetheLock DOH!谢谢,比较是颠倒的,现在已经修复了。 –