我能够运行Firefox和Chrome(在本地进行自动化测试),但它已经有一段时间了。我在Chrome上试用它时遇到了一些错误。
我的版本:
我在控制台中收到以下错误(当我尝试运行Chrome时):ERROR: An unknown server-side error occurred while processing the command. (UnknownError:13) Chrome
。
在控制台中运行了 selenium-server ,我得到了:os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121' Driver info: driver.version: unknown
还有:
执行:[new session:Capabilities [{rotating = true,seleniumProtocol = WebDriver,locationContextEnabled = true,loggingPrefs=org.openqa.selenium.logging.LoggingPreferences@8ac8f23,browserName = chrome,javascriptEnabled = true,chromeOptions = {args = [ - start-maximized, - start-fullscreen]},handlesAlerts = true,maxInstances = 1,requestOrigins = {name ** = webdriverio,version = 4.6.2 **,url = http://webdriver.io}} ]]) INFO - 为Capabilities创建一个新会话[{rotating = true,seleniumProtocol = WebDriver,locationContextEnabled = true,loggingPrefs = org.openqa.selenium.logging.LoggingPreferences @,browserName = chrome,javascriptEnabled = true,chromeOptions = {args = [ - -start-maximized, - start-fullscreen]},handlesAlerts = true,maxInstances = 1,requestOrigins = {name = webdriverio,version = 4.6.2,url = http://webdriver.io}}] 错误 - org.apache.commons.exec.ExecuteException:进程退出并显示错误:-1073741819(退出值:-1073741819) 警告 - 抛出异常
我正在使用 WebdriverIO ,测试是用JavaScript编写的。
package.json 内容:
dependencies": {
"chai": "3.5.0",
"chai-as-promised": "6.0.0",
"chai-string": "1.3.0",
"chai-subset": "1.5.0",
"chai-things": "0.2.0",
"jsonfile": "3.0.0",
"moment": "2.18.1",
"node-gyp": "3.6.1",
"node-ninja": "1.0.2",
"node-uuid": "1.4.8",
"webdriverio": "4.8.0"
},
"peerDependencies": {
"mocha": "^3"
},
"devDependencies": {
"babel-cli": "6.24.1",
"babel-core": "6.24.1",
"babel-plugin-transform-object-rest-spread": "6.23.0",
"babel-plugin-transform-runtime": "6.23.0",
"babel-preset-es2015": "6.24.1",
"babel-register": "6.24.1",
"chromedriver": "2.29.0",
"cross-env": "4.0.0",
"eslint": "^3.19.0",
"eslint-config-airbnb": "15.0.1",
"eslint-plugin-import": "2.2.0",
"eslint-plugin-jsx-a11y": "^5.0.1",
"eslint-plugin-react": "7.0.0",
"eslint-plugin-webdriverio": "1.0.1",
"express": "4.15.2",
"geckodriver": "1.6.1",
"marked": "0.3.6",
"marked-terminal": "2.0.0",
"mocha": "3.3.0",
"mocha-babel": "3.0.3",
"mocha-junit-reporter": "1.13.0",
"mocha-parallel-tests": "1.2.9",
"mocha-prepare": "0.0.1",
"mocha-traceur": "2.1.0",
"progress": "2.0.0",
"request": "2.81.0",
"selenium-standalone": "6.4.1",
"supertest": "3.0.0",
"tedious": "2.0.0",
"tedious-connection-pool": "1.0.5",
"uuid": "3.0.1",
"wdio-allure-reporter": "0.1.2",
"wdio-browserstack-service": "0.1.4",
"wdio-concise-reporter": "0.1.2",
"wdio-dot-reporter": "0.0.8",
"wdio-firefox-profile-service": "0.0.3",
"wdio-jasmine-framework": "0.3.1",
"wdio-json-reporter": "0.2.1",
"wdio-junit-reporter": "0.3.0",
"wdio-mocha-framework": "0.5.10",
"wdio-phantomjs-service": "0.2.2",
"wdio-sauce-service": "0.4.0",
"wdio-selenium-standalone-service": "0.0.8",
"wdio-spec-reporter": "0.1.0"
我删除了 node_modules 文件夹,然后通过 npm (本地)再次安装,但它没有帮助。
当我将 wdio.config.js 从Chrome切换到Firefox时,就会运行Firefox。我的一个朋友正在使用相同版本的Chrome,它可以运行。
在控制台中写的是 webdriverio, version=4.6.2
,因此版本与 package.json 不同,但是我应该安装另一个版本(不是最新版本),或者我怎么能这样做?
谢谢和问候。
更新: wdio配置文件
pastebin com / Jd9WrH7B
答案 0 :(得分:1)
您有以下选择:
1。)如果您想通过npm run <testName>
使用最新版本("webdriverio": "4.8.0"
)继续运行测试用例,那么:
a。更新全局WebdriverIO实例:npm install -g webdriverio@latest
或npm install -g webdriverio@4.8.0
(这会将您的全局WebdriverIO版本更新为4.8.0
);
b。或者,使用当前版本的WebdriverIO运行测试用例:./node_modules/.bin/wdio <wdioConfigFile>
(在您的情况下为wdio.config.js
)。这应该从您的项目根目录运行;
c。尝试通过项目根目录中的npm update
强制更新您的依赖项; (这更像是 Hail Marry!)。
注意:这些只有在您已经 selenium-standalone 的情况下才有效
作为wdio.config.js
文件中的服务(services: ['selenium-standalone']
)。
2。)如果您仍有问题,请在wdio.config.js
文件中评论 selenium-standalone 服务热线,然后开始使用chromedriver
selenium-standalone实例:
从您选择的控制台(或cmd
)中使用:java -Dwebdriver.chrome.driver=C:\selenium\chromedriver.exe -jar selenium-server-standalone-3.0.1.jar -port 4444
。
注意:您需要在启动服务器的文件夹中包含最新的 chromedriver.exe 二进制文件,以及{{3 }} .jar
。我把它们放在C:\selenium\
。
如果有任何这些帮助你,请告诉我!就像我说的那样,可能是因为这个错误而判断的。至少你正在缩小范围。