Styrow.dev
Question 40 of 82

How do we clear the Textbox value in Selenium?

Question

How do we clear the Textbox value in Selenium?

Answer

We can clear the Textbox value by using clear() method. Below is the code

WebDriver driver = new FirefoxDriver();

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

driver.findElement(By.xpath(""xpathToBeGiven"")).sendKeys(""CodeGreen"");

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


šŸ“² Practice Offline on Mobile: Download the free QA Automation & SDET Prep app on Google Play & App Store.