【问题标题】:Selenium Webdriver throws timeout excption for chromeSelenium Webdriver 为 chrome 抛出超时异常
【发布时间】:2018-07-14 23:46:05
【问题描述】:

我已经更新了 chrome 和 WebDriver 的版本。仍然收到超时异常。它以前工作正常,但突然开始出现异常。它甚至没有达到测试。如果有人有解决方案租赁帮助。

Version 64.0.3282.140 (Official Build) (64-bit)

Webdriver: WebDriver.ChromeDriver.win32 2.35.0

var smth = m_driver.WaitUrl(new Regex(settings.GetSiteString("xyz") + "#/.*"));

for (int maxWait = 60000; maxWait > 0; maxWait--, System.Threading.Thread.Sleep(500))
    if (m_driver.FindElement("//div[@ng-show='vm.loaded']").Displayed)
    {
        System.Threading.Thread.Sleep(500);
        return;
    }

throw new TimeoutException("Failed to wait for xyz page to load.");

错误消息:对 URL http://localhost:63425/session/cdc3e59/url 的远程 WebDriver 服务器的 HTTP 请求在 120 秒后超时。

【问题讨论】:

  • 请提供更多信息,例如您尝试运行的脚本。您正在使用的确切版本等。
  • chrome 版本 - 版本 64.0.3282.140(官方构建)(64 位)WebDriver.ChromeDriver.win32 2.35.0
  • 硒版本?脚本?
  • 脚本是什么意思?我会在哪里得到那个?抱歉,我是这些测试的新手
  • 您尝试执行的测试脚本?

标签: google-chrome selenium automated-tests


【解决方案1】:

尝试使用最新的“Chrome 驱动程序”

【讨论】:

  • 我有最新版本的 Chrome 驱动
【解决方案2】:

似乎将 no-sandbox 参数添加到您的 chrome 驱动程序选项可以解决问题。我仍在试图弄清楚为什么这会解决它。

这是一个如何实例化 ChromeDriver 的示例,以便它不会在实际加载正确的页面上给您超时。

var chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("no-sandbox");

var webDriver = new ChromeDriver(Directory.GetCurrentDirectory(), chromeOptions);

我在this Github thread找到了这个解决方案

【讨论】:

    猜你喜欢
    • 2016-09-16
    • 2013-02-22
    • 2017-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-31
    相关资源
    最近更新 更多