Protractor does not find chromedriver: The driver

2019-02-17 13:34发布

问题:

I am trying to get Protractor up and running following the official Getting Started Guide.

The command

webdriver-manager start

seems to run smoothly:

webdriver-manager start
seleniumProcess.pid: 22169
Apr 23, 2014 10:27:46 AM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
Setting system property webdriver.chrome.driver to /usr/local/lib/node_modules/protractor/selenium/chromedriver
10:27:46.959 INFO - Java: Apple Inc. 20.65-b04-462
10:27:46.960 INFO - OS: Mac OS X 10.8.5 x86_64
10:27:46.968 INFO - v2.41.0, with Core v2.41.0. Built from revision 3192d8a
10:27:47.021 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: MAC
10:27:47.059 INFO - RemoteWebDriver instances should connect to: <link deleted>
10:27:47.059 INFO - Version Jetty/5.1.x
10:27:47.060 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
10:27:47.060 INFO - Started HttpContext[/selenium-server,/selenium-server]
10:27:47.061 INFO - Started HttpContext[/,/]
10:27:47.092 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@4cc39a20
10:27:47.092 INFO - Started HttpContext[/wd,/wd]
10:27:47.096 INFO - Started SocketListener on 0.0.0.0:4444
10:27:47.096 INFO - Started org.openqa.jetty.jetty.Server@1d5a0305

However, running

protractor /usr/local/lib/node_modules/protractor/example/conf.js 

as suggested leads to errors:

protractor /usr/local/lib/node_modules/protractor/example/conf.js 
Using the selenium server at <link deleted>

/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1702
  throw error;
        ^
UnknownError: The driver executable does not exist: /usr/local/lib/node_modules/protractor/selenium/chromedriver
at <anonymous>

and the old window throws exception:

10:30:19.106 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:17:32'
System info: host: 'Dmitris-MacBook-Pro.local', ip: '172.20.10.2', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.5', java.version: '1.6.0_65'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:177)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:113)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:90)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:96)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:63)
10:30:19.110 WARN - Exception: The driver executable does not exist: /usr/local/lib/node_modules/protractor/selenium/chromedriver

Any idea what is wrong?

回答1:

Delete that un-completed zip file(chromedriver_x.xx.zip), and you need it execute the update again. The folder will look like this:

chromedriver

chromedriver_2.10.zip

selenium-server-standalone-2.43.1.jar

and everything goes well.



回答2:

This is happening because of the latest update for chromedriver. If you are using protractor, then a easy way to fix the problem is just run this

webdriver-manager update

Its working fine for me now.



回答3:

For Mac users:

Under the 'angular-phonecat' folder, run npm install chromedriver. This will install the chrome driver into the folder node_modules/chromedriver. After this, you should modify the test/protractor-conf.js, pointing it to the new chromedriver folder, by adding this line:

chromeDriver:'../node_modules/chromedriver/bin/chromedriver',

Finally, you will run successfully the command npm run protractor (don't forget that npm start should be run first).



回答4:

I had a similar problem in my environment (Mac OS X 10.8.5).

After struggling it for more than an hour, I finally installed the older version (1.4.0) of the protractor and it works very fine.

npm install -g protractor@1.4.0

If you would use grunt task grunt-protractor-webdriver, you should use the version 0.1.9 which is working properly in my env. Its 0.2.0 version doesn't work for me. thanks.



回答5:

In protractor-config you need to specify the chrome driver path. For example chromeDriver: 'path',



回答6:

I encountered a problem with not being able to run my protractor tests, after updating MacOSX to el Capitan.

I was able to solve the problem by re-installing the chromedriver on the system. Try running "sudo npm install chromedriver" from your console. This solved the problem for me.



回答7:

I ran into the same issue when building/testing the same tutorial. In the project selenium folder I had chromedriver_2.13.zip, but no chromedriver exec file. I tried unzipping it directly, but no joy.

So I installed protractor globally using sudo npm install -g protractor, which installs the files at usr/local/lib/node_modules/protractor/selenium/ (on a Mac). In that folder the chromedriver executable did exist, so I copy/pasted into the project selenium folder and now protractor runs as expected using the npm run protractor command from inside the project folder.



回答8:

I had the problem on my Mac. I solved it by:

Downloading the latest chromedriver manually. Copying it to the desired location (protactor/selenium/). Try again - worked