QualiT
QualiT

Reputation: 1955

"WebDriverError: Unknown error" when using Selenium with Edge Chromium, Javascript bindings

When trying to run Selenium on Windows 10 Edge Chrome version 80, I am getting the following error:

Z:\node_modules\selenium-webdriver\lib\promise.js:2626
        throw error;
        ^

WebDriverError: Unknown error
    at parseHttpResponse (Z:\node_modules\selenium-webdriver\lib\http.js:536:11)
    at Z:\node_modules\selenium-webdriver\lib\http.js:441:30
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
From: Task: WebDriver.createSession()

[...]

I am building it like this:

const webdriver = require('selenium-webdriver'),
    edge = require('selenium-webdriver/edge');

 var service = new edge.ServiceBuilder()
     .setPort(55555)
     .build();

 var options = new edge.Options();
 driver = edge.Driver.createSession(options, service);

Does anyone see why this might be happening? Has anyone had success building the driver using the javascript bindings and can share how they were able to do that?

I'm confident that I have the correct version of the Microsoft Edge Driver

Upvotes: 2

Views: 720

Answers (1)

QualiT
QualiT

Reputation: 1955

/* In another command prompt window enter the command:
   msedgedriver.exe --verbose  

   Then run the script as normal in the other command prompt
*/
const Selenium = require("selenium-webdriver");
const BROWSER_NAME = Selenium.Browser.EDGE;
const builder = new Selenium.Builder().forBrowser(BROWSER_NAME)
.withCapabilities({
        "browserName": 'MicrosoftEdge',
        "browserVersion": '81.0',
        "platformName": 'Windows 10',
        'ms:edgeChromium': true
    }).usingServer('http://localhost:9515')

const driver = builder.build()

Upvotes: 2

Related Questions