Do a google search using selenium WebDriver - Java HTML

Java examples for HTML:selenium

Description

Do a google search using selenium WebDriver

Demo Code



import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Googlesearch {

     public static void main(String[] args) {
          // TODO Auto-generated method stub
          /*from w  ww .ja v  a 2 s  .  c  o m*/
          WebDriver driver = new FirefoxDriver();
          driver.get("http://google.com");
          WebElement element = driver.findElement(By.name("q"));
          element.sendKeys("test");
          element.submit();
          System.out.println("page title is :"+driver.getTitle());

     }

}

Related Tutorials