【发布时间】:2021-09-01 19:42:03
【问题描述】:
我正在编写一个 if 条件来查找项目中的元素位置。
if (!(driver.findElement(MobileBy.xpath(ObjRepoProp.getProperty("searchTextBox_XPATH"))).isDisplayed()
|| driver.findElement(MobileBy.xpath(ObjRepoProp.getProperty("routeOverview_XPATH"))).isDisplayed()
|| driver.findElement(MobileBy.xpath(ObjRepoProp.getProperty("scrollNavigationDrawer_XPATH")))
.isDisplayed())) {
throw new IllegalStateException("This is not Destination Input page");
}
在此代码中,如果其中一个条件为真,则“org.openqa.selenium.NoSuchElementException:使用给定的搜索参数无法在页面上找到一个元素。”触发器和测试用例失败。
【问题讨论】:
标签: java selenium if-statement