I'm trying to run protractor by connecting directly to Chrome, not running Selenium. As the docs say, this is possible by setting the directConnect
to true
in the config file.
When I run protractor with directConnect: true
, I get:
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver Error: spawn ENOENT at errnoException (child_process.js:1001:11) at Process.ChildProcess._handle.onexit (child_process.js:792:34) [launcher] Process exited with error code 1
If I run protractor without directConnect
and instead specify my selenium url, everything runs fine.
I'm running Protractor version 1.6.1, Chrome version 41.0.2272.35 beta-m (64-bit), and Chromedriver version 2.13.0.
Update: While the solution below worked for me, after talking with a protractor dev I realized that if I run webdriver-manager update
to install a local chromedriver, then I don't need to set the chromeDriver
setting in my protractor config.
I had the same issue and solved it by varying the chromeDriver
path setting in protractor-conf.js depending on whether I was on Windows or OSX/Linux.
Solution and writeup below assumes you are using chromedriver provided by npm install chromedriver
. Also this solution worked with protractor 3.2.2
and chromedriver 2.21.2
.
Protractor+chromedriver worked on OSX and Linux but I was getting ENOENT errors on Windows. I have filed an issue here and have also documented a workaround.
The issue (I think) is that childProcess.spawn has issues on Windows (see a list of issues here) and the node_modules/chromedriver/bin/chromedriver
file will not correctly run when called via childProcess.spawn
- likely because this file is not executable and Windows doesn't know to use the node
binary to interpret the file.
The workaround is to provide the path to the windows executable when running on Windows. It is easy enough - though hackish - to vary the chromeDriver
arg in protractor-conf.js as demonstrated below :
protractor-conf.js for all three OS:
var chromeDriverPath = process.platform === 'win32' ? 'node_modules/chromedriver/lib/chromedriver/chromedriver.exe' : 'node_modules/chromedriver/bin/chromedriver';
exports.config = {
directConnect: true,
chromeDriver: chromeDriverPath,
specs: [
'features/*.feature'
],
capabilities: {
browserName: 'chrome',
platform: 'ANY',
chromeOptions: {
args: ['--test-type']
}
}
}
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With