Aug 22, 2019 in Selenium
Q: How to clear the text in the text box using Selenium WebDriver?

1 Answer

0 votes
Aug 22, 2019
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();
Click here to read more about Selenium
Click here to read more about Insurance

Related questions

0 votes
Aug 22, 2019 in Selenium
...