Chromedriver 意外退出

Chromedriver unexpectedly quit

我正在使用 nightwatch.js 版本 0.9.8 和节点 v4.4.3,我收到错误 "Chromedriver unexpectedly quit"。

我试过使用不同版本的 nightwatch、selenium 和 chromedriver,但同样的事情不断发生。

这是 selenium 的输出:

12:13:55.692 INFO - SessionCleaner initialized with insideBrowserTimeout 0 and clientGoneTimeout 1800000 polling every 180000
12:13:55.725 INFO - Executing: [new session: Capabilities [{acceptSslCerts=true, phantomjs.binary.path=./lib/phantomjs, name=**my site** / Search, browserName=chrome, javascriptEnabled=true, chromeOptions={args=[start-kiosk], prefs={download={default_directory=./test-files/downloads/, prompt_for_download=false}}}, platform=ANY}]])
12:13:55.742 INFO - Creating a new session for Capabilities [{acceptSslCerts=true, phantomjs.binary.path=./lib/phantomjs, name=**my site**  / Search, browserName=chrome, javascriptEnabled=true, chromeOptions={args=[start-kiosk], prefs={download={default_directory=./test-files/downloads/, prompt_for_download=false}}}, platform=ANY}]
Starting ChromeDriver 2.13.307650 (feffe1dd547ee7b5c16d38784cd0cd679dfd7850) on port 25433
Only local connections are allowed.
12:13:56.196 INFO - Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
12:13:56.868 INFO - Detected dialect: OSS
12:13:56.883 INFO - Done: [new session: Capabilities [{acceptSslCerts=true, phantomjs.binary.path=./lib/phantomjs, name=**my site**  / Search, browserName=chrome, javascriptEnabled=true, chromeOptions={args=[start-kiosk], prefs={download={default_directory=./test-files/downloads/, prompt_for_download=false}}}, platform=ANY}]]
12:13:56.898 INFO - Executing: [get: https://**my site** ])
12:13:57.523 WARN - Exception thrown
org.openqa.selenium.WebDriverException: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"73757.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.13.307650 (feffe1dd547ee7b5c16d38784cd0cd679dfd7850),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 19 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: '**my computer** ', ip: '10.0.1.2', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_31'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=/var/folders/5w/jh9886055gndhfs4y3c8mfd40000gn/T/.org.chromium.Chromium.xwDlJP}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=54.0.2840.71, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 23364f0f90fbb61bad760ccbeea45f6c
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
    at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:322)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.openqa.selenium.support.events.EventFiringWebDriver.invoke(EventFiringWebDriver.java:103)
    at com.sun.proxy.$Proxy4.get(Unknown Source)
    at org.openqa.selenium.support.events.EventFiringWebDriver.get(EventFiringWebDriver.java:162)
    at org.openqa.selenium.remote.server.handler.ChangeUrl.call(ChangeUrl.java:40)
    at org.openqa.selenium.remote.server.handler.ChangeUrl.call(ChangeUrl.java:25)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.openqa.selenium.remote.server.DefaultSession.run(DefaultSession.java:176)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
12:13:57.526 WARN - Exception: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"73757.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.13.307650 (feffe1dd547ee7b5c16d38784cd0cd679dfd7850),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 19 milliseconds

此外,chromedriver 独立运行良好:

Last login: Thu Oct 27 12:21:43 on ttys003
**path**/chromedriver ; exit;
➜  ~ **path**/chromedriver ; exit;
Starting ChromeDriver 2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1) on port 9515
Only local connections are allowed.

感谢任何帮助!

通过 npm i -g chromedriver.

简单修复