Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

How to print text from a list of all web elements with same class name in Selenium

Category: Selenium WebDriver

driver.get(“https://www.hireqa.co.in”);

List list= driver.findElements(By.className(“store-name”));

System.out.println(list.size());

for (WebElement webElement : list) {
String name = webElement.getText();
System.out.println(name);
}

Leave a Reply

Your email address will not be published. Required fields are marked *