in Selenium by
Q:
How to clear the text in the text box using Selenium WebDriver?

► Click here to show 1 Answer

0 votes
by
By using clear() method

WebDriver driver = new FirefoxDriver();

driver.get("https://www.gmail.com");

driver.findElement(By.xpath("xpath_of_element1")).sendKeys("Software Testing Material Website");

driver.findElement(By.xpath("xpath_of_element1")).clear();

1

2

3

4

WebDriver driver = new FirefoxDriver();

driver.get("https://www.gmail.com");

driver.findElement(By.xpath("xpath_of_element1")).sendKeys("Software Testing Material Website");

driver.findElement(By.xpath("xpath_of_element1")).clear();
Selenium
Learn More with Madanswer

Related questions

0 votes
asked Aug 22, 2019 in Selenium by john ganales
...