Friday 20 June 2014

All browsers

package TestNG;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.safari.SafariDriver;

import com.opera.core.systems.OperaDriver;

public class AllBrowsers {
    public WebDriver driver;
    public void openURL(){
        driver=new FirefoxDriver();
        driver.get("http://google.co.in");
    }
    public void safari(){
        driver=new SafariDriver();
        driver.get("http://google.co.in");
    }
    public void opera(){
        driver=new OperaDriver();
        driver.get("http://google.co.in");   
    }
    public void chrome(){
System.setProperty("webdriver.chrome.driver", "E:\\Library\\chromedriver.exe");       
        driver=new ChromeDriver();
        driver.get("http://google.co.in");
    }
    public void ie(){
System.setProperty("webdriver.ie.driver", "E:\\Library\\IEDriverServer.exe");       
        driver=new InternetExplorerDriver();
        driver.get("http://google.co.in");       
    }
   

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        AllBrowsers a=new AllBrowsers();
        a.openURL();
        //a.safari();
        //a.opera();
        a.chrome();
        a.ie();
    }

}






No comments:

Post a Comment