1

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 UPDATE: Also note that Edge launches, but never begins navigating. The script works fine for all other browsers.

Possible relevant note: I'm running in a VirtualBox VM of Windows 10, but the automation scripts all live on the Z: on my Mac. I have added the z: to my path.

MicrosoftwebDriver is running, too: Running, too

8
  • Is the edge driver in path? Did u install the correct driver version ?
    – PDHide
    Commented Apr 14, 2020 at 5:56
  • sqa.stackexchange.com/questions/42978/…
    – PDHide
    Commented Apr 14, 2020 at 13:01
  • Edge launches, so i am convinced I have the right driver. I'll recheck the path.
    – QualiT
    Commented Apr 14, 2020 at 15:50
  • so what's the issue you are facing if edge is opening ?
    – PDHide
    Commented Apr 14, 2020 at 15:56
  • 1
    even your code works fine in my system
    – PDHide
    Commented Apr 14, 2020 at 16:33

2 Answers 2

2

Verify that driver is in PATH:

just open cmd and type the driver name,

enter image description here

This is the tested code for Edge legacy:

const {Builder, By, Key, until} = require('selenium-webdriver');

(async function example() {
  let driver = await new Builder().forBrowser('MicrosoftEdge').build();
  try {
    await driver.get('http://www.google.com/ncr');
    await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
    await driver.wait(until.titleIs('webdriver - Google Search'), 1000);
  } finally {
    await driver.quit();
  }
})();

Note: I have the webdriver in the path, so if C:/tmp/MicrosoftWebDriver.exe is the path of your webdriver then add c:/tmp/ to path

I checked your code even thats working:

const {Builder, By, Key, until} = require('selenium-webdriver');

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);

(async function a(){


    await driver.get('http://www.google.com/ncr');
    await driver.findElement(By.name('q')).sendKeys('webdriver');
    await driver.wait(until.titleIs('webdriver - Google Search'), 1000);
    await driver.quit();
})()
2
  • 1
    you can verify that drriver is present by opening cmd and typing the name
    – PDHide
    Commented Apr 14, 2020 at 16:37
  • I've verified that it is present. "Listening on localhost:17556"
    – QualiT
    Commented Apr 14, 2020 at 16:46
0

Finally got it to work.

/* 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()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.