【发布时间】:2022-07-07 23:26:18
【问题描述】:
我正在测试一个关闭窗口的按钮。然后当我点击按钮时,我需要检查窗口是否关闭。
我创建了这个方法:
enter code here
public boolean isElementPresent(String locatorKey) {
try {
driver.findElement(By.xpath(locatorKey));
return true;
} catch (org.openqa.selenium.NoSuchElementException e) {
Assert.assertFalse((isElementPresent(String.valueOf(By.xpath(locatorKey)))));
return false;
}
}
enter code here
但它不起作用。 Selenium 一直在加载最后一步,最后显示这个错误
命令:[8139ce6f8c35642a752d7fbedb186ec6, findElement {using=xpath, value=By.xpath: By.xpath: By.xpath: By.xpath: By.xpath: By.xpath: By.xpath: By.xpath: By. xpath: By.xpath:
【问题讨论】:
标签: java selenium selenium-webdriver selenium-java