const {Builder, By, Key, util} = require("selenium-webdriver/Firefox");
async function example(){
let driver = await new Builder().forBrowser('Firefox').build();
await driver.get("https://www.google.com");
await driver.findElement(By.name("q")).sendKeys("Selenium", Key.RETURN);
Hello, I am constantly getting these errors, although I added the webdriver path in the system and I cant execute the test. Has anyone experienced something like that?
(node:15844) UnhandledPromiseRejectionWarning: Error: Do not know how to build driver: Firefox
(node:4764) UnhandledPromiseRejectionWarning: TypeError: Builder is not a constructor
Got the same error "TypeError: Builder.forBrowser is not a constructor" for a sample code from any tutorial. Turns out they miss parenthesis after Builder.
The correct code:
let driver = await new Builder().forBrowser('chrome').build();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With