我试图在http://angular.github.io/protractor/#/运行普通的Protillactor示例。我已完成所有步骤,但我收到以下错误。
我已尝试使用binary: "/Applications/Google\ Chrome.app"
和binary: "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
的解决方案HERE和HERE,但两种方法均无效
我不确定我还能配置什么;它似乎没有效果。知道我能做些什么才能让它发挥作用?
修改 我可以在http://localhost:4444/wd/hub看到状态,因此不确定问题是使用量角器配置还是使用webdriver-manager。
webdriver-manager错误:
Starting ChromeDriver 2.13.307650 (feffe1dd547ee7b5c16d38784cd0cd679dfd7850) on port 10276
Only local connections are allowed.
15:18:35.760 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'localhost', ip: '127.0.0.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.8.0_31'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:175)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:111)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:88)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:108)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:57)`
量角器运行出错:
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
ERROR - Unable to start a WebDriver session.
/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113
var template = new Error(this.message);
^
UnknownError: The process has not exited yet therefore no result is available ...
at new bot.Error (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113:18)
at Object.bot.response.checkResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:152:24
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
at notifyAll (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:442:7)
at resolve (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:420:7)
at fulfill (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:535:5)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
at notifyAll (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:442:7)
at resolve (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:420:7)
at [object Object].fulfill (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:535:5)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:721:49
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/http/http.js:96:5
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:131:7)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:943:16
at process._tickCallback (node.js:419:13)
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:149:22)
at Function.webdriver.WebDriver.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:123:30)
at [object Object].Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:294:22)
at [object Object].DriverProvider.getNewDriver (/usr/local/lib/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7)
at [object Object].Runner.createBrowser (/usr/local/lib/node_modules/protractor/lib/runner.js:180:37)
at /usr/local/lib/node_modules/protractor/lib/runner.js:246:21
at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:759:13)
at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:573:44
at flush (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:419:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:906:3
[launcher] Process exited with error code 1`
答案 0 :(得分:6)
我能够将其缩小到通过改为使用Firefox来查找/初始化Chrome的问题:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
capabilities: {
'browserName': 'firefox'
},
}
此配置正常运行并在FF中运行测试。
随后我一直挖到这个帖子:https://github.com/angular/protractor/issues/1424并且看到chromedriver偶尔会出现兼容性问题。
所以我在http://chromedriver.storage.googleapis.com/index.html尝试了不同的版本,最终取代了/usr/local/lib/node_modules/protractor/selenium/chromedriver
版本(2.9)的最新版本(2.13)。
这解决了我。
<强>更新强>
看起来安装较新的Chromedriver版本2.15也可以解决这个问题
答案 1 :(得分:1)
我去了类似的问题
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
...
Caused by: java.lang.IllegalStateException: The process has not exited yet therefore no result is available ...
at org.apache.commons.exec.DefaultExecuteResultHandler.getException(DefaultExecuteResultHandler.java:74)
at org.openqa.selenium.os.UnixProcess.checkForError(UnixProcess.java:165)
at org.openqa.selenium.os.CommandLine.checkForError(CommandLine.java:183)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:170)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:62)
at
并将chromedriver从2.14降级到2.9解决了这个问题。 Windows 2008 R2 Ent,Chrome版本41.0.2272.101 m。奇怪的是,在'相同'的系统上它与chromedrive 2.14一起工作。还有一个发现。设置-Dwebdriver.chrome.logfile = chromedriver.log为2.14生成空日志,而2.9写入是日志确定