SessionNotCreatedException:消息:无法创建新服务:通过Python与ChromeDriver和SeleniumGrid一起使用的ChromeDriverService

编程入门 行业动态 更新时间:2024-10-28 18:30:51
本文介绍了SessionNotCreatedException:消息:无法创建新服务:通过Python与ChromeDriver和SeleniumGrid一起使用的ChromeDriverService的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

任何人都知道这是怎么回事或如何调试错误,如下所示.我所做的步骤是使用setup hub命令并将节点注册到集线器.在命令注册节点之后.我可以看到日志为

Hi anyone know what is going on or how I can debug the error as following. the step I did is using setup hub command and register node to hub. after the command register node. I can see the log as

The node is registered to the hub and ready to use

但是,当我运行测试脚本时,我将错误打印为:

However when I run the test script I have error print up as:

seleniummon.exceptions.SessionNotCreatedException: Message: Unable to create new service: ChromeDriverService

二进制版本:

  • 硒独立版本:3.14.0
  • 硒远程驱动程序版本:selenium == 3.14.1
  • python版本:3.6.4

脚本:

import os from selenium import webdriver from selenium.webdrivermon.desired_capabilities import DesiredCapabilities driver = webdriver.Remote(command_executor='localhost:4444/wd/hub', desired_capabilities=DesiredCapabilities.CHROME)

设置中心:

#java -jar /Users/admin/selenium-server-standalone-3.14.0.jar -host localhost -role hub

注册节点:

#java -jar /Users/admin/selenium-server-standalone-3.14.0.jar -role node

错误:

E seleniummon.exceptions.SessionNotCreatedException: Message: Unable to create new service: ChromeDriverService E Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z' E Driver info: driver.version: unknown E Stacktrace: E at org.openqa.selenium.remote.server.ServicedSession$Factory.lambda$get$0 (ServicedSession.java:134) E at org.openqa.selenium.remote.server.ServicedSession$Factory.apply (ServicedSession.java:151) E at org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$apply$12 (ActiveSessionFactory.java:177) E at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:193) ... E at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511) E at java.util.concurrent.FutureTask.run (FutureTask.java:266) E at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142) E at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617) E at java.lang.Thread.run (Thread.java:745) ../lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py:242: SessionNotCreatedException

推荐答案

此错误消息...

seleniummon.exceptions.SessionNotCreatedException: Message: Unable to create new service: ChromeDriverService

...表示 ChromeDriver 无法启动/产生新的 ChromeDriverService .

...implies that the ChromeDriver was unable to initiate/spawn a new ChromeDriverService.

正在使用的二进制版本之间,在命令和不兼容中存在两个问题:

There are a couple of issues in the commands and incompatibility between the version of the binaries you are using as follows:

  • 您的 JDK版本是 1.8.0_91 ,这很漂亮古代.
  • 将 JDK 升级到最新级别 JDK 8u181 .
  • 要注册 Selenium Grid Hub ,您需要使用以下命令:

  • Your JDK version is 1.8.0_91 which is pretty ancient.
  • Upgrade JDK to recent levels JDK 8u181.
  • To register a Selenium Grid Hub you need to use the following command:

>java -jar /Users/admin/selenium-server-standalone-3.14.0.jar -role hub

  • 要为 ChromeDriver 和 Chrome 注册 Selenium Grid节点,您需要传递 ChromeDriver的绝对路径以及注册URI 的 Key 和 Value ,如下所示:

  • To register a Selenium Grid Node for ChromeDriver and Chrome you need to pass the absolute path of the ChromeDriver along with the Key and Value of the Registration URI as follows:

    >java -Dwebdriver.chrome.driver=/path/to/chromedriver.exe -jar /Users/admin/selenium-server-standalone-3.14.0.jar -role node -hub <IP_GRID_HUB>:4444/grid/register

  • 您的代码块对我来说很好.

  • You code block looks good to me.

  • 更多推荐

    SessionNotCreatedException:消息:无法创建新服务:通过Python与ChromeDriver和SeleniumGrid一起使用的Chr

    本文发布于:2023-11-17 15:50:48,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1610282.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:消息   Python   SessionNotCreatedException   ChromeDriverService   SeleniumGrid

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!