我正在尝试为ngwebdriver实现这段代码,但出现错误

时间:2019-11-06 14:31:55

标签: java selenium-webdriver

org.openqa.selenium.ScriptTimeoutException:脚本超时引发以下代码工作

driver.manage().timeouts().setScriptTimeout(60, TimeUnit.SECONDS);
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

    if (System.getProperty("os.name").contains("Mac")){
        System.setProperty("webdriver.chrome.driver", ResourceHelper.getResourcePath("/src/main/resources/drivers/chromedriver"));
        driver = ThreadGuard.protect(new ChromeDriver(options));
        JavascriptExecutor jsDriver = (JavascriptExecutor) driver;
        ngDriver = new NgWebDriver(jsDriver);
        ngDriver.waitForAngularRequestsToFinish();

       }
    else if(System.getProperty("os.name").contains("Window")){
        System.setProperty("webdriver.chrome.driver", ResourceHelper.getResourcePath("/src/main/resources/drivers/chromedriver.exe"));
        driver = ThreadGuard.protect(new ChromeDriver(options));
        driver.manage().timeouts().setScriptTimeout(60, TimeUnit.SECONDS);
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        JavascriptExecutor jsDriver = (JavascriptExecutor) driver;
       ngDriver = new NgWebDriver(jsDriver);
        ngDriver.waitForAngularRequestsToFinish();


    }
    return driver;
}

以上代码在执行时会引发错误-

org.openqa.selenium.ScriptTimeoutException: script timeout

0 个答案:

没有答案