1

在过去的几天里,我使用 Selenium WebDriver 运行测试没有任何问题。但是,即使我没有更改代码或系统中的任何内容,但最近几次尝试创建新的浏览器会话时,我总是收到以下错误: Link

无论我是尝试通过代码还是通过浏览器手动创建会话,都会发生这种情况。

这是运行 Selenium 服务器和三个测试的结果:

$ java -jar selenium-server-standalone-3.9.1.jar 
05:54:58.659 INFO - Selenium build info: version: '3.9.1', revision: '63f7b50'
05:54:58.660 INFO - Launching a standalone Selenium Server on port 4444
2019-04-18 05:54:58.754:INFO::main: Logging initialized @269ms to org.seleniumhq.jetty9.util.log.StdErrLog
2019-04-18 05:54:58.821:INFO:osjs.Server:main: jetty-9.4.7.v20170914, build timestamp: 2017-11-21T22:27:37+01:00, git hash: 82b8fb23f757335bb3329d540ce37a2a2615f0a8
2019-04-18 05:54:58.840:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@65d6b83b{/,null,STARTING} has uncovered http methods for path: /
2019-04-18 05:54:58.843:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@65d6b83b{/,null,AVAILABLE}
2019-04-18 05:54:58.859:INFO:osjs.AbstractConnector:main: Started ServerConnector@1de74ecb{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2019-04-18 05:54:58.859:INFO:osjs.Server:main: Started @374ms
05:54:58.859 INFO - Selenium Server is up and running on port 4444
2019-04-18 05:55:04.002:INFO:osjshC.ROOT:qtp527446182-17: org.openqa.selenium.remote.server.WebDriverServlet-57175e74: Initialising WebDriverServlet
05:55:04.110 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.Status@4d5a702a
05:55:04.114 INFO - /status: Executing GET on /status (handler: Status)
05:55:04.178 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.GetAllSessions@3026be33
05:55:04.178 INFO - /sessions: Executing GET on /sessions (handler: GetAllSessions)
05:55:09.248 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@48e79260
05:55:09.249 INFO - /session: Executing POST on /session (handler: BeginSession)
05:55:09.333 INFO - Capabilities are: Capabilities {browserName: chrome}
05:55:09.334 INFO - Capabilities {browserName: chrome} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706) on port 27011
Only local connections are allowed.
05:55:09.788 INFO - Detected dialect: OSS
06:01:50.907 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@79d0ad1d
06:01:50.907 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@1ff85274
06:01:50.907 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@2d87d7a2
06:01:50.908 INFO - /session: Executing POST on /session (handler: BeginSession)
06:01:50.908 INFO - /session: Executing POST on /session (handler: BeginSession)
06:01:50.908 INFO - /session: Executing POST on /session (handler: BeginSession)
06:01:50.912 INFO - Capabilities are: Capabilities {browserName: chrome}
06:01:50.912 INFO - Capabilities are: Capabilities {browserName: chrome}
06:01:50.912 INFO - Capabilities are: Capabilities {browserName: chrome}
06:01:50.912 INFO - Capabilities {browserName: chrome} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
06:01:50.912 INFO - Capabilities {browserName: chrome} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
06:01:50.912 INFO - Capabilities {browserName: chrome} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706) on port 29789
Only local connections are allowed.
Starting ChromeDriver 2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706) on port 32366
Only local connections are allowed.
Starting ChromeDriver 2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706) on port 15121
Only local connections are allowed.
06:01:51.271 INFO - Detected dialect: OSS
06:01:51.335 INFO - Detected dialect: OSS
06:01:51.449 INFO - Detected dialect: OSS

我试过降级,重新安装所有东西,但似乎没有任何效果。

我正在使用什么:

  • Ubuntu 18.04
  • Selenium Java 服务器 3.9.1
  • 铬 73
  • 铬驱动程序 74

此外,奇怪的是,我的同事和我同样在 Selenium 上工作,现在在他们自己的系统上遇到了完全相同的问题。

4

1 回答 1

2

此错误消息...

Starting ChromeDriver 2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706) on port 15121
Only local connections are allowed.
06:01:51.271 INFO - Detected dialect: OSS

...表示您的ChromeDriver版本是chromedriver=2.41

您的主要问题是您使用的二进制文件版本之间的不兼容,如下所示:

  • 您正在使用chromedriver=2.41
  • chromedriver=2.41的发行说明清楚地提到了以下内容:

支持Chrome v67-69

  • 大概您使用的是最新的 GAed chrome=73.0
  • ChromeDriver v2.46的发行说明清楚地提到了以下内容:

支持Chrome v71-73

因此ChromeDriver v2.41Chrome 浏览器 v73.0之间存在明显的不匹配


解决方案

于 2019-04-18T06:16:53.930 回答