Login into a page with username text box having id as loginid,password id as password and button id as button.
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class Login { public static void main(String[] args) throws Exception { WebDriver driver = new FirefoxDriver(); driver.get("http://"); WebElement id = driver.findElement(By.id("loginID")); WebElement pass = driver.findElement(By.id("password")); WebElement button = driver.findElement(By.id("Button")); id.sendKeys("Cheese"); pass.sendKeys("password"); button.click(); } }