在Selenium WebDriver中是否有任何方法可以获取页面中的所有框架?就像我们有获取所有窗口句柄的方法一样.
driver.getWindowHandles()
Run Code Online (Sandbox Code Playgroud) 嗨,我需要检查下拉字段是否有给定的值,但这些值未被选中,因此它不会显示在下拉框中.我有关于元素的Xpath
//table[contains(@id,'Field')]//tr[td//span[text()='Code']]/preceding-sibling::*[1]/td//select[contains(@id,'GSRCH_FLT')]/option[text()='not=']
Run Code Online (Sandbox Code Playgroud)
这是在浏览器中正确识别元素.但是,当我使用以下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();
Run Code Online (Sandbox Code Playgroud)
它返回false,因为它没有显示在框中.
你能告诉我替代方案吗?