我试图点击关闭按钮关闭弹出窗口。但是,我收到错误element not visible
。我正在检查页面中是否存在该元素,但仍然出现错误。给出错误的代码是
while(driver.findElements(By.className("ui_close_x")).size() < 0);
driver.findElements(By.className("ui_close_x")).get(0).click();
System.out.println("Clkd");
我哪里错了?
尝试抓取tripAdvisor
答案 0 :(得分:1)
WebDriverWait wait = new WebDriverWait(driver, 10);
List<WebElement> elements = wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.className("ui_close_x")));
elements.get(0).click();