Monday, December 15, 2014


In this tutorial, I will tell you how to write text in the forms. Selenium webdriver provides a method called sedKeys() which help us to write text in the forms automatically.





import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;

public class Training {

 public static void main(String[] args) {

  WebDriver driver = new FirefoxDriver();
  driver.get("https:// login.yahoo. com/?.src=ym&.intl=us&.lang=en-US&.done=https%3a// mail.yahoo. com");
  driver.manage().window().maximize();
  driver.findElement(By.id("login-username")).sendKeys("some text");
  driver.findElement(By.id("login-passwd")).sendKeys("some password");

 }

}