I'm trying to set up selenium-webdriver example using Javascript and Microsoft Edge. In any other browser this code below works. But Edge won't start. I tried to find a solution, but couldnt find anything that helped me... Maybe you can help.
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();
}
})();
Its to easiest example from the webdriver's npm-page. https://www.npmjs.com/package/selenium-webdriver
I'm getting following error:
[Running] node "c:\Users\mr\Desktop\Selenium\SeleniumToJS\test.js"
(node:3700) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'start' of null
(node:3700) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[Done] exited with code=0 in 0.512 seconds
If I insert 'edge' instead of 'MicrosoftEdge' follwing returns:
[Running] node "c:\Users\mreinwald\Desktop\Selenium\SeleniumToJS\loginLogout.js"
(node:18112) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Do not know how to build driver: edge; did you forget to call usingServer(url)?
(node:18112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[Done] exited with code=0 in 0.499 seconds
'MicrosoftEdge'
and not'edge'
? Also, is the edge webdriver in thePATH
? – Hollander'edge'
is the same error? – Hollander(node:18112) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Do not know how to build driver: edge; did you forget to call usingServer(url)?
How do I useusingServer(url)
? – Insignificancenpm install selenium-webdriver
– Insignificance