gpt4 book ai didi

google-chrome - 通过 Selenium Java 使用 ChromeDriver 和 Chrome v80 从渲染器接收消息超时 : 0. 100 条日志消息

转载 作者:行者123 更新时间:2023-12-01 16:28:44 24 4
gpt4 key购买 nike

我们最近使用 ChromeDriver v80.0.3987.16 和 Chrome v80.0.3987.87(官方版本)(64 位)升级了测试环境,升级后,即使是最小的程序也会生成大量以下严重日志:

[1581082019.282][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082020.245][SEVERE]: Timed out receiving message from renderer: 0.100

之前,在使用 ChromeDriver v79.0/Chrome v79.0 组合之前,偶尔会观察到这些消息。

最小代码块:

public class chromeDemo 
{
public static void main(String[] args)
{
System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com/");
driver.quit();
}
}

控制台输出:

Starting ChromeDriver 80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185}) on port 9194
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Feb 07, 2020 6:56:57 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
[1581082019.282][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082020.245][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082020.430][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082020.531][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082020.632][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082020.734][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082020.835][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082021.364][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082021.544][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082021.647][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082021.748][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082021.850][SEVERE]: Timed out receiving message from renderer: 0.100
[1581082021.952][SEVERE]: Timed out receiving message from renderer: 0.100

有人面临同样的情况吗?ChromeDriver/Chrome v80 相对于 ChromeDriver/Chrome v79 是否有任何变化?有什么线索吗?

最佳答案

临时解决方案

以下是针对不同 Chrome 用户的解决方案。

  • 如果您使用的是 Chrome v80,请使用最近发布的 ChromeDriver 80.0.3987.106解决了问题。

    • 代码块:

      System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      driver.quit();
    • 控制台输出:

      Starting ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882}) on port 20041
      Only local connections are allowed.
      Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
      Feb 14, 2020 9:50:57 PM org.openqa.selenium.remote.ProtocolHandshake createSession
      INFO: Detected dialect: W3C
  • 如果您使用的是 Chrome v81,请使用最近发布的 ChromeDriver 81.0.4044.20解决了问题。

  • 如果您使用的是 Dev or Canary 中的 Chrome您需要获取特定于平台的二进制文件的 channel :
<小时/>

永久解决方案

但是,@bugdroid 通过此 revision 提交了实际修复。/commit如下:

[ChromeDriver] suppress logging of retry loop timeout: r1924789 added a retry loop while waiting for DevTools messages. This spammed users' logs with uninformative timeout reports. This CL suppresses those log messages and correctly reports the command timeout value when appropriate.

注意:

  • Status: Fixed
  • Labels: ToBeReleased ChromeDriver-82
<小时/>

历史记录

此错误消息...

[1581082020.245][SEVERE]: Timed out receiving message from renderer: 0.100

...并不一定表示失败。

作为@Tricia mentions ChromeDriver 版本 80 修改了等待循环以允许更多重试;这个循环将生成该消息,但它会继续监听。然而,该消息的 SEVERE 标签具有误导性。

此外,在讨论中Issue 3332: Retry timeout logged as severe , @triciac [ChromeDriver Committer] 还补充说,ChromeDriver 团队在 DevToolsClientImpl::HandleEventsUntil 中添加了一个小超时(100 毫秒),以启用对导航状态的额外检查。但是,不幸的是,当此超时到期时,它会被记录为“SEVERE”(由 ProcessNextMessage)。在这种小超时的情况下,它不应记录为SEVERE,尽管 SendCommandInternal 的超时仍然应该记录为SEVERE

因此 ChromeDriver 需要一种更好的方式来控制日志记录,可能是通过增加超时。但是,如果命令最终超时,且列出的超时持续时间非常小,则需要改为列出用户定义的超时。

<小时/>

立即解决

作为临时解决方案,您可以降级到 ChromeDriver v79.0.3945.36因为看起来SEVERE日志没有显示在控制台中,但您会看到警告:

[WARNING]: This version of ChromeDriver has not been tested with Chrome version 80

这听起来像是一个...安全的解决方法...并且已得到 Chromium 团队成员的确认。

chromedriver79

  • 代码块:

    public class A_Chrome 
    {
    public static void main(String[] args)
    {
    System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
    WebDriver driver = new ChromeDriver();
    driver.get("https://www.google.com/");
    driver.quit();
    }
    }
  • 控制台输出:

    Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 9200
    Only local connections are allowed.
    Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
    [1581503845.444][WARNING]: This version of ChromeDriver has not been tested with Chrome version 80.
    Feb 12, 2020 4:07:26 PM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Detected dialect: W3C
<小时/>

tl;博士

您可以在以下位置找到一些相关讨论:

关于google-chrome - 通过 Selenium Java 使用 ChromeDriver 和 Chrome v80 从渲染器接收消息超时 : 0. 100 条日志消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62095398/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com