Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const {By,Key,Builder} = require("selenium-webdriver");
- require("chromedriver");
- async function ricerca(){
- var searchString = "Automation testing with Selenium";
- //Lanciare il browser
- let driver = await new Builder().forBrowser("chrome").build();
- //Visualizzare https://duckduckgo.com/
- await driver.get("https://duckduckgo.com/");
- //inserire la nostra stringa di ricerca
- await driver.findElement(By.name("q")).sendKeys(searchString,Key.RETURN);
- //Recuperiamo il titolo e stampiamolo
- var title = await driver.getTitle();
- console.log('Il titolo è:',title);
- //Buona abitudine
- await driver.quit();
- }
- ricerca()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement