Category : selenium-webdriver

I’m trying to create a program to google search using selenium based on this answer, so far the code looks like this const { Builder, By, Key, until } = require(‘selenium-webdriver’); const driver = new Builder().forBrowser("firefox").build(); (async () => { await driver.get(`https://www.google.com`); var el = await driver.findElement(By.name(‘q’)); await driver.wait(until.elementIsVisible(el),1000); await el.sendKeys(‘selenium’); var el = await ..

Read more

I am having a problem while executing Selenium scripts on an already opened browser in nodejs. I get some insight from other languages like java // set the driver path- You can also use WebDriverManager for drivers System.setProperty("webdriver.chrome.driver","E:MukeshDatachromedriver.exe"); // Create object of ChromeOptions Class ChromeOptions opt=new ChromeOptions(); the question is that how can I add ..

Read more

In my Testsuite I use selenium with Firefox. The following Setup does work on my first Dev-machine as well as in the CI. On my second machine driver stays undefined after webdriver.Builder.built(). Code: require(‘selenium-webdriver’); const jasmine = require(‘jasmine’); const { Options } = require(‘selenium-webdriver/firefox’); const { Builder, By, Key } = require(‘selenium-webdriver’); let driver; const ..

Read more

I’ve made a node.js script like this: const { Builder, By, Key, until } = require(‘selenium-webdriver’); const driver = new Builder().forBrowser("firefox").build(); const search_query = ‘tigers’; (async () => { await driver.get(`https://www.google.com/search?q=${search_query}`); const h3Elements = await driver.findElements(By.css(‘h3’)); for (const h3 of h3Elements) { console.log(await h3.getText()); } console.log(‘…Task Complete!’) })(); and now I want to test it ..

Read more

I’m creating a small program to return the name of all the link titles when you search for something on google using selenium here’s the code: const {Builder,By, Key, until} = require(‘selenium-webdriver’); driver = new Builder().forBrowser("firefox").build(); var search_query=’tigers’; (async()=>{ await driver.get(`https://www.google.com/search?q=${search_query}`); await driver.findElements(By.css(‘h3’)).then((search_results)=>{ for (var i = 0; i < search_results.length; i++) search_results[i].getText().then((text)=>{console.log(text);}) }); console.log(‘…Task ..

Read more

Here I’m trying to enter modified XML using below code but no luck. driver.execute_script(‘document.getElementsByTagName("pre")[4].innerText ="’ + outfileStr + ‘";’) outfileStr is my modified XML data. I’m able to send a text but the issue is that whenever I click out of the box entire text will remove. I’m able to do the same task using ..

Read more

https://www.selenium.dev/documentation/en/webdriver/locating_elements/ says: Selenium 4 brings Relative Locators which are previously called as Friendly Locators. This functionality was added to help you locate elements that are nearby other elements. The Available Relative Locators are: above below toLeftOf toRightOf near findElement method now accepts a new method withTagName() which returns a RelativeLocator. It also provides a JavaScript ..

Read more