How To Clear Text Box in Selenium Webdriver

How To Clear Text Box in Selenium webdriver 
Using Clear method to we clear the text box in selenium webdriver

Clear ();
clear method is a predefined selenium webdriver  Class is used to text box .

driver.findElement(By.id("email")).clear();

Selenium Code for clear the text box using selenium webdriver 

package automationtesting;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class SendKeysMethod
 {
public static void main(String[] args)
 {
 System.setProperty("webdriver.chrome.driver","D:\\Sandeep\\Soft\\chromedriver.exe");
WebDriver driver= new ChromeDriver();
driver.get("https://facebook.com");
driver.findElement(By.id("email")).sendKeys("sandeep@gamil.com");
driver.findElement(By.id("email")).clear();
driver.findElement(By.id("email")).sendKeys("sandeep123@gamil.com");
 driver.findElement(By.id("pass")).sendKeys("abc@123");
}
}

Hope!!! The above code for how to clear the text box in selenium webdriver helpful for you ..
Team 
QA acharya 

Tags: how to clear the text box in selenium , how to clear the text box using selenium webdriver . Clear method in selenium , 

How To Clear Text Box in Selenium Webdriver

Post a Comment

0 Comments