gpt4 book ai didi

angularjs - 无法启动 ChromeDriver-Protractor

转载 作者:行者123 更新时间:2023-12-03 10:06:23 25 4
gpt4 key购买 nike

我已经看到其他几个线程处理类似的问题,但不一样。我使用直接连接到浏览器和 ChromeDriver有时无法启动并出现以下错误。看起来我可以在配置文件中设置一些浏览器超时,只是无法弄清楚。 conf.js好像

'use strict';

exports.config = {
/* seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
** enables to connect to the browsers directly.
** http://stackoverflow.com/questions/27889488/cannot-run-protractor-on-internet-explorer-11
*/

directConnect: true,
specs: ['giftengHomePageTests.js'],

multiCapabilities: [{
'browserName': 'chrome'
}, {
'browserName': 'firefox'
},

/**
* {
* 'browserName': 'internet explorer'
* }
* */

],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
isVerbose: true
},

onPrepare: function () {
browser.driver.manage().window().maximize();
}
}

[chrome #1] Using ChromeDriver directly...

[chrome #1] ERROR - Unable to start a WebDriver session.

[chrome #1] Error: listen EACCES



错误更新

我已经多次运行这些相同的测试,现在在 Firefox 驱动程序上失败了。很不规律

"D:\Program Files (x86)\JetBrains\WebStorm 9.0.3\bin\runnerw.exe" "D:\Program Files\nodejs\node.exe" d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\lib\cli.js specs\smoke\conf.js [launcher] Running 2 instances of WebDriver


[firefox #2] PID: 5748 [firefox #2] Specs: e:\working\protractor-e2e\specs\smoke\giftengHomePageTests.js [firefox #2] [firefox #2] Using FirefoxDriver directly... [firefox #2] ERROR - Unable to start a WebDriver session. [firefox #2] Error: listen EACCES [firefox #2] at exports._errnoException (util.js:746:11) [firefox #2] at Server._listen2 (net.js:1112:19) [firefox #2] at listen (net.js:1155:10) [firefox #2] at Server.listen (net.js:1240:5) [firefox #2] at isFree (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\net\portprober.js:165:10) [firefox #2] at findPort (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\net\portprober.js:197:7) [firefox #2] at d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\net\portprober.js:186:5 [firefox #2] at [object Object].promise.ControlFlow.runInFrame_ (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1877:20) [firefox #2] at [object Object].promise.Callback_.goog.defineClass.notify (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:2464:25) [firefox #2] at [object Object].promise.Promise.notify_ (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:563:12) [firefox #2] From: Task: WebDriver.createSession() [firefox #2] at Function.webdriver.WebDriver.acquireSession_ (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:155:22) [firefox #2] at Function.webdriver.WebDriver.createSession (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:129:30) [firefox #2] at new Driver (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\firefox\index.js:272:36) [firefox #2] at [object Object].DirectDriverProvider.getNewDriver (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\direct.js:75:16) [firefox #2] at [object Object].Runner.createBrowser (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:180:37) [firefox #2] at d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:257:21 [firefox #2] at _fulfilled (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:797:54) [firefox #2] at self.promiseDispatch.done (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:826:30) [firefox #2] at Promise.promise.promiseDispatch (d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:759:13) [firefox #2] at d:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:573:44

[launcher] Runner process exited unexpectedly with error code: 1 [launcher] 1 instance(s) of WebDriver still running

..

[chrome #1] PID: 8084 [chrome #1] Specs: e:\working\protractor-e2e\specs\smoke\giftengHomePageTests.js [chrome #1] [chrome #1] Using ChromeDriver directly... [chrome #1] gifteng page [chrome #1] Should pop up sign in modal box - pass [chrome #1] WARNING - more than one element found for locator By.xpath("//img[contains(@src,'welcome/gift.jpg')]") - the first result will be used [chrome #1] Should navigate to gifteng Give page - pass [chrome #1] [chrome #1] [chrome #1] Finished in 7.522 seconds [chrome #1] 2 tests, 2 assertions, 0 failures [chrome #1] [launcher] 0 instance(s) of WebDriver still running [launcher] firefox #2 failed with exit code: 1 [launcher] chrome #1 passed [launcher] overall: 1 process(es) failed to complete [launcher] Process exited with error code 100

Process finished with exit code 100

最佳答案

您缺少告诉配置在哪里可以找到 chromeDriver 的行:

exports.config = {
directConnect: true,
chromeDriver: '/chromedriver/chromedriver_win32/chromedriver.exe',
....

关于angularjs - 无法启动 ChromeDriver-Protractor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29337903/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com