无法在 selenium/java 中使用 google 单击“继续”按钮

问题描述 投票:0回答:0

按照“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;
        }
}`

按钮所在网址: https://admin.dev.getontop.com/#/login

java xpath automated-tests path-finding google-logging
© www.soinside.com 2019 - 2024. All rights reserved.