Selenium error: "WebDriverError: unknown error: Failed to create Chrome process."

When I run my code, selenium returns an unexplained error:

WebDriverError: unknown error: Failed to create Chrome process.
    at Object.throwDecodedError (C:\Users\aaron\Downloads\webscraper\node_modules\selenium-webdriver\lib\error.js:522:15)
    at parseHttpResponse (C:\Users\aaron\Downloads\webscraper\node_modules\selenium-webdriver\lib\http.js:589:13)
    at Executor.execute (C:\Users\aaron\Downloads\webscraper\node_modules\selenium-webdriver\lib\http.js:514:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  remoteStacktrace: 'Backtrace:\n' +
    '\tOrdinal0 [0x00D2C0A3+2212003]\n' +
    '\tOrdinal0 [0x00CC2CC1+1780929]\n' +
    '\tOrdinal0 [0x00BD465D+804445]\n' +
    '\tOrdinal0 [0x00BF208F+925839]\n' +
    '\tOrdinal0 [0x00BEF5B9+914873]\n' +
    '\tOrdinal0 [0x00C23AD9+1129177]\n' +
    '\tOrdinal0 [0x00C2373A+1128250]\n' +
    '\tOrdinal0 [0x00C1EA36+1108534]\n' +
    '\tOrdinal0 [0x00BF83C9+951241]\n' +
    '\tOrdinal0 [0x00BF9396+955286]\n' +
    '\tGetHandleVerifier [0x00FD9CE2+2746722]\n' +
    '\tGetHandleVerifier [0x00FCA234+2682548]\n' +
    '\tGetHandleVerifier [0x00DBB34A+524234]\n' +
    '\tGetHandleVerifier [0x00DB9B60+518112]\n' +
    '\tOrdinal0 [0x00CC9FBC+1810364]\n' +
    '\tOrdinal0 [0x00CCEA28+1829416]\n' +
    '\tOrdinal0 [0x00CCEB15+1829653]\n' +
    '\tOrdinal0 [0x00CD8744+1869636]\n' +
    '\tBaseThreadInitThunk [0x770AFA29+25]\n' +
    '\tRtlGetAppContainerNamedObjectPath [0x77217A9E+286]\n' +
    '\tRtlGetAppContainerNamedObjectPath [0x77217A6E+238]\n'
}

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.



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations