How to get the count of all text box in a web page?
To get the count of all text boxes in a web page, we can use Selenium's findElements() method with the input type 'text'.
Use Selenium's findElements() method to find all elements with the input type '...read more
public class Counttestbox {
public static void main(String[] args) {
WebDriverManager.chromedriver().setup();
WebDriver driver=new ChromeDriver();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
driver.get("https://testautomationpractice.blogspot.com/");
driver.manage().window().maximize();
//select specific one textboxes
//driver.findElement(By.xpath("//input[@id='monday']")).click();
//total number of textboxes
List<WebElement> textboxes=driver.findElements(By.xpath("//input[@type='text']"));
System.out.println("Total number of textboxes:"+textboxes.size());
}
}
textbox = driver.find_elements(By,TagName , "Textarea")
counter = len(textbox)
textbox = driver.find_elements(By,TagName , "Textarea")
counter = len(textbox)
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("http://localhost/2010A15/?p=register");
java.util.List
Top Cognizant Selenium Automation Tester interview questions & answers
Popular interview questions of Selenium Automation Tester
Reviews
Interviews
Salaries
Users/Month