Selenium服务器错误:无法创建新服务chromedriverservice [英] Selenium server error: Unable to create new service chromedriverservice
问题描述
我试图在我的Windows 10计算机上运行webdriverio并在尝试运行我的测试js文件时继续遇到同样的问题。所以我运行 -jar /your/download/directory/selenium-server-standalone-3.5.3.jar
来启动服务器并且出来了此输出
I am trying to run webdriverio on my windows 10 computer and keep running into the same issue when trying to run my test js file. So I run this -jar /your/download/directory/selenium-server-standalone-3.5.3.jar
to start the server and that comes out with this output
13:06:19.471 INFO - Selenium build info: version: '3.5.3', revision: 'a88d25fe6b'
13:06:19.472 INFO - Launching a standalone Selenium Server
2018-02-16 13:06:19.503:INFO::main: Logging initialized @301ms to org.seleniumhq.jetty9.util.log.StdErrLog
13:06:19.564 INFO - Driver class not found: com.opera.core.systems.OperaDriver
13:06:19.600 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN10
13:06:19.640 INFO - Using the passthrough mode handler
2018-02-16 13:06:19.673:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2018-02-16 13:06:19.697:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@3e9b1010{/,null,STARTING} has uncovered http methods for path: /
2018-02-16 13:06:19.703:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@3e9b1010{/,null,AVAILABLE}
2018-02-16 13:06:19.807:INFO:osjs.AbstractConnector:main: Started ServerConnector@4e7dc304{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2018-02-16 13:06:19.808:INFO:osjs.Server:main: Started @605ms
13:06:19.808 INFO - Selenium Server is up and running
之后我打开了一个新的命令行提示符并运行了我的test.js文件,看起来像这样
So after that I opened up a new command line prompt and ran my test.js file that looks like this
var webdriverio = require('webdriverio');
var options = {
desiredCapabilities: {
browserName: 'chrome'
}
};
webdriverio
.remote(options)
.init()
.url('http://www.google.com')
.getTitle().then(function(title) {
console.log('Title was: ' + title);
})
.end()
.catch(function(err) {
console.log(err);
});
这是我得到的错误
{ Error: A new session could not be created.
at end() - C:\Users\KenyaThompson\Desktop\test.js:16:6
details: undefined,
message: 'Unable to create new service: ChromeDriverService\nBuild info: version: \'3.5.3\', revision: \'a88d25fe6b\', time: \'2017-08-29T12:54:15.039Z\'\nSystem info: host: \'LAPTOP-9GIHGJ9I\', ip: \'10.0.0.243\', os.name: \'Windows 10\', os.arch: \'amd64\', os.version: \'10.0\', java.version: \'1.8.0_161\'\nDriver info: driver.version: unknown',
type: 'RuntimeError',
seleniumStack:
{ type: 'SessionNotCreatedException',
message: 'A new session could not be created.',
orgStatusMessage: 'Unable to create new service: ChromeDriverService\nBuild info: version: \'3.5.3\', revision: \'a88d25fe6b\', time: \'2017-08-29T12:54:15.039Z\'\nSystem info: host: \'LAPTOP-9GIHGJ9I\', ip: \'10.0.0.243\', os.name: \'Windows 10\', os.arch: \'amd64\', os.version: \'10.0\', java.version: \'1.8.0_161\'\nDriver info: driver.version: unknown' } }
有人可以向我解释我在这里做错了什么吗?也是的,我已经通过npm以及wdio-chromedriver-service安装了chromedriver。
Could someone please explain to me what I am doing wrong here? Also yes I already installed chromedriver via npm as well as wdio-chromedriver-service.
推荐答案
你看到的错误确实给了我们关于什么是错误的一些提示如下:
The error you are seeing does gives us some hint about whats going wrong as follows :
{ type: 'SessionNotCreatedException',
message: 'A new session could not be created.',
orgStatusMessage: 'Unable to create new service: ChromeDriverService\nBuild info: version: \'3.5.3\', revision: \'a88d25fe6b\', time: \'2017-08-29T12:54:15.039Z\'\nSystem info: host: \'LAPTOP-9GIHGJ9I\', ip: \'10.0.0.243\', os.name: \'Windows 10\', os.arch: \'amd64\', os.version: \'10.0\', java.version: \'1.8.0_161\'\nDriver info: driver.version: unknown' }
从错误消息中可以清楚地看到 ChromeDriver 没有得到de当您将日志消息视为驱动程序信息:driver.version: unknown
时,请注意。此错误的主要原因可能是您正在使用的二进制文件之间的不兼容。
It is clear from the error message that the ChromeDriver is not getting detected as you see the log message as Driver info: driver.version: unknown
. The main reason of this error can be the incompatibility between the binaries you are using.
- 您的 Selenium客户端版本是 3.5.3 已发布 2017-08-29T12:54:15.039Z
- 您的 ChromeDriver 版本未知给我们。
- 您的 Chrome浏览器版本未知给我们。
- Your Selenium Client version is 3.5.3 released 2017-08-29T12:54:15.039Z
- Your ChromeDriver version is unknown to us.
- Your Chrome Browser version is unknown to us.
快速解决方案是:
- 将 Selenium客户端版本更新到最近的级别,即 Selenium 3.9.1
- 将 ChromeDriver 版本更新到最近的级别,即 ChromeDriver 2.35
- 根据 发行说明 href =https://chromedriver.storage.googleapis.com/2.35/notes.txt\"rel =nofollow noreferrer> ChromeDriver v2.35 更新 Chrome浏览器版本 v62-64
- 运行
CCleaner 工具,用于在执行测试之前和之后擦除操作系统杂务套件 - 如果 Chrome浏览器的基本版本为旧版,请通过 Chrome浏览器: //www.revouninstaller.com/revo_uninstaller_free_download.html\"rel =nofollow noreferrer> Revo Uninstaller 并安装最新的GA发布版 Chrome浏览器
- 执行测试。
- Update Selenium Client version to recent levels i.e. Selenium 3.9.1
- Update ChromeDriver version to recent levels i.e. ChromeDriver 2.35
- As per the Release Notes of ChromeDriver v2.35 update the Chrome Browser version to v62-64
- Run CCleaner tool to wipe off the OS chores before and after executing your Test Suite
- If your base version of Chrome Browser is olden uninstall Chrome Browser through Revo Uninstaller and install a recent GA released version of Chrome Browser
- Execute your Test.
这篇关于Selenium服务器错误:无法创建新服务chromedriverservice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!