Issue
When I run my code, selenium returns an unexplained error:
WebDriverError: unknown error: Failed to create Chrome process.
Why is this happening and how do I fix this?
Here is my code:
const {Builder} = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
(async function openChromeTest() {
try {
let options = new chrome.Options().setChromeBinaryPath(`${__dirname}`);
let driver = await new Builder()
.setChromeOptions(options)
.forBrowser('chrome')
.build();
await driver.get('https://www.google.com');
await driver.quit();
} catch (error) {
console.log(error)
}
})();
Please note that I have not added chromewebdriver.exe to my path at the default locaton. I'm trying to store it inside my node.js directory.
Solution
Ah, it turns out that I was very confused. I thought that setChromeBinaryPath linked to a chromedriver executable, but it actually links to a chrome executable.
Answered By - Isaac W
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.