【问题标题】:SessionNotCreatedException: Message: Unable to create new service: ChromeDriverService with Selenium 3.14.0 and Python 3.7.3SessionNotCreatedException:消息:无法创建新服务:使用 Selenium 3.14.0 和 Python 3.7.3 的 ChromeDriverService
【发布时间】:2019-12-19 01:18:02
【问题描述】:

Python 3.7.3

Pycharm 2019.1.3

硒独立 3.14.0

硒 3.141.0

Java JDK 12.0.2

Windows 7

当我尝试使用远程 webdriver 运行脚本时出现错误,我的 java.version 不是我预期的(预期版本至少为 12。):

selenium.common.exceptions.SessionNotCreatedException: Message: Unable to create new service: ChromeDriverService
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'host_name', ip: 'localhost', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_221'
Driver info: driver.version: unknown
Stacktrace:
    at org.openqa.selenium.remote.server.ServicedSession$Factory.lambda$get$0 (ServicedSession.java:134)
    at org.openqa.selenium.remote.server.ServicedSession$Factory.apply (ServicedSession.java:151)
    at org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$apply$12 (ActiveSessionFactory.java:177)
    at java.util.stream.ReferencePipeline$3$1.accept (None:-1)
    at java.util.stream.ReferencePipeline$11$1.accept (None:-1)
    at java.util.stream.ReferencePipeline$2$1.accept (None:-1)
    at java.util.Spliterators$ArraySpliterator.tryAdvance (None:-1)
    at java.util.stream.ReferencePipeline.forEachWithCancel (None:-1)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel (None:-1)
    at java.util.stream.AbstractPipeline.copyInto (None:-1)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (None:-1)
    at java.util.stream.FindOps$FindOp.evaluateSequential (None:-1)
    at java.util.stream.AbstractPipeline.evaluate (None:-1)
    at java.util.stream.ReferencePipeline.findFirst (None:-1)
    at org.openqa.selenium.remote.server.ActiveSessionFactory.apply (ActiveSessionFactory.java:180)
    at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$null$2 (NewSessionPipeline.java:65)
    at java.util.stream.ReferencePipeline$3$1.accept (None:-1)
    at java.util.stream.ReferencePipeline$2$1.accept (None:-1)
    at java.util.Collections$2.tryAdvance (None:-1)
    at java.util.stream.ReferencePipeline.forEachWithCancel (None:-1)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel (None:-1)
    at java.util.stream.AbstractPipeline.copyInto (None:-1)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (None:-1)
    at java.util.stream.FindOps$FindOp.evaluateSequential (None:-1)
    at java.util.stream.AbstractPipeline.evaluate (None:-1)
    at java.util.stream.ReferencePipeline.findFirst (None:-1)
    at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$createNewSession$3 (NewSessionPipeline.java:68)
    at java.util.stream.ReferencePipeline$3$1.accept (None:-1)
    at java.util.stream.ReferencePipeline$3$1.accept (None:-1)
    at java.util.stream.ReferencePipeline$3$1.accept (None:-1)
    at java.util.stream.DistinctOps$1$2.accept (None:-1)
    at java.util.stream.ReferencePipeline$2$1.accept (None:-1)
    at java.util.stream.ReferencePipeline$3$1.accept (None:-1)
    at java.util.stream.ReferencePipeline$2$1.accept (None:-1)
    at java.util.stream.Streams$StreamBuilderImpl.tryAdvance (None:-1)
    at java.util.stream.Streams$ConcatSpliterator.tryAdvance (None:-1)
    at java.util.stream.ReferencePipeline.forEachWithCancel (None:-1)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel (None:-1)
    at java.util.stream.AbstractPipeline.copyInto (None:-1)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (None:-1)
    at java.util.stream.FindOps$FindOp.evaluateSequential (None:-1)
    at java.util.stream.AbstractPipeline.evaluate (None:-1)
    at java.util.stream.ReferencePipeline.findFirst (None:-1)
    at org.openqa.selenium.remote.server.NewSessionPipeline.createNewSession (NewSessionPipeline.java:71)
    at org.openqa.selenium.remote.server.commandhandler.BeginSession.execute (BeginSession.java:65)
    at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$3 (WebDriverServlet.java:250)
    at java.util.concurrent.Executors$RunnableAdapter.call (None:-1)
    at java.util.concurrent.FutureTask.run (None:-1)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
    at java.lang.Thread.run (None:-1)

我尝试重新安装 java JDK,但版本保持不变 - 1.8.0_221

我在 python 中的代码:

driver = webdriver.Remote(
   command_executor='http://10.20.10.193:4444/wd/hub',
   desired_capabilities=DesiredCapabilities.CHROME)

driver.get('https://google.com')

设置硒服务器:

java -jar selenium-server-standalone-3.14.0.jar

我做错了什么?

【问题讨论】:

  • 您是否在集线器上注册了节点?也是 Chrome 和 chrome 驱动程序的版本。它们兼容吗?
  • 不,我没有在集线器上注册节点 - 我要试试。是 Chrome 和 chrome 驱动版本 ale 兼容 v76。
  • allselenium.info/execute-python-selenium-tests-in-selenium-grid查看教程。没有节点测试将无法运行。
  • 还是有问题,但我会从现在开始,谢谢好人。

标签: python selenium google-chrome selenium-chromedriver selenium-remotedriver


【解决方案1】:

此错误消息...

selenium.common.exceptions.SessionNotCreatedException: Message: Unable to create new service: ChromeDriverService
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'host_name', ip: 'localhost', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_221'
Driver info: driver.version: unknown

...暗示 ChromeDriver 未被识别。

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

Selenium Client Driver 页面提及:

所以可能 Python 3.7.3 仍然不受支持,您可能需要将 python 降级到相关版本。


结尾

Unable to import org.openqa.selenium.WebDriver using Selenium and Java 11

【讨论】:

  • 您在该页面的哪个位置看到仅支持 2.7、3.4、3.5 和 3.6?
  • @DebanjanB 我正在运行 python 3.8,所以我降级到 3.6.3,但仍然是同样的错误。
猜你喜欢
  • 1970-01-01
  • 2018-12-17
  • 1970-01-01
  • 2018-07-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多