按照“Continuar com o Google”按钮登录xpath,尝试了多个xpath,但每次都显示相同的错误消息: org.openqa.selenium.TimeoutException: Expected condition failed: waiting for visibility of element located by.xpath: //div/span[contains(text(),'Continuar com o Google')](尝试 30 秒,间隔 500 毫秒)
按照我试过的“Continuar com o Google”按钮登录 xpaths:
`WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30)); WebElement divElement = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div/span[contains(text(),'Continuar com o Google')]"))); divElement.click(); driver.quit();
试过这个 xpath 但它没有用: WebElement element = driver.findElement(By.xpath("//div/span[contains(text(),'Continuar com o Google')]")); JavascriptExecutor js = (JavascriptExecutor) 驱动程序; js.executeScript("arguments[0].click();", element);
List<WebElement> options = driver.findElements(By.xpath("//div/span[contains(text(),'Continuar com o Google')]"));
for (WebElement option : options) {
if (option.getText().equals("Continuar com o Google")) {
option.click();
break;
}
}`