tl;dr: Does anyone know how to pass the path of chromedriver to selenium-webdriver in code without setting the PATH environment variable?
I'm attempting to use selenium-webdriver with chrome, but would prefer to not physically install chromedriver and manipulate the path. I have the following code:
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();
Without chromedriver set in the path, this throws the error:
Error: The ChromeDriver could not be found on the current PATH. Please download the latest
version of the ChromeDriver from http://chromedriver.storage.googleapis.com/index.html and
ensure it can be found on your PATH.
I'd prefer not have to setup my path, so I've installed chromedriver from npm and added to my package.json:
"scripts": {
"preinstall-chromedriver": "npm install",
"install-chromedriver": "node node_modules/chromedriver/install.js",
"pretest_e2e": "npm run install-chromedriver",
"test_e2e": "node release/test/rune2e.js"
},
Now I have chromedriver installed and can get the path with require('chromedriver').path
, but I have no way of passing this to the selenium-webdriver. Anyone know?
from Passing require('chromedriver).path directly to selenium-webdriver
No comments:
Post a Comment