Tuesday, 14 July 2015

HOW TO WORK WITH SELENIUM WEBDRIVER USING FIREFOX,INTERNET EXPLORER,GOOGLLE CHROME


FIREFOX
package pack1;

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

public class web {

          public static void main(String[] args) {
                   WebDriver wd =new FirefoxDriver();
wd.get("http:yahoomail.com");

wd.findElement(By.xpath(".//*[@id='username']")).sendKeys("akhilreddyhyd@yahoo.com");
wd.findElement(By.xpath(".//*[@id='passwd']")).sendKeys("venkanna143");
wd.findElement(By.xpath(".//*[@id='.save']")).click();
          }

}

INTERNET EXPLORER

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;


public class ieeeeeeeeeee {

         
          public static void main(String[] args) {
                   WebDriver driver = new InternetExplorerDriver();
                    driver.manage().window().maximize();
                    driver.get("http://google.com");

                    driver.quit();
          }


GOOGLE CHROME


System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe");
                   WebDriver driver = new ChromeDriver();
driver.get("http://google.com");


No comments:

Post a Comment