System.setProperty("webdriver.firefox.bin", "C:\\Program Files\\Mozilla Firefox\\firefox.exe");
System.setProperty("webdriver.chrome.driver", "D:\\Selenium Auto\\selenium\\chromedriver.exe");
System.setProperty("webdriver.ie.driver", "D:\\Selenium Auto\\selenium\\IEDriverServer_Win32_2.43.0\\IEDriverServer.exe");
WebDriver driver;
//默认在C盘的安装路径
System.setProperty("webdriver.firefox.bin", "C:\\Program Files\\Mozilla Firefox\\firefox.exe");
//实例化
driver = new FirefoxDriver();
String testUrl = "http://baidu.com";
driver.get(testUrl);
driver.quit();
package com.selenium;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.chrome.*;
public class seleniumTest1 {
public static WebDriver driver;
public static void main(String[] args) {
// TODO Auto-generated method stub
// chrome();
ie();
}
public static void ie(){
System.setProperty("webdriver.ie.driver", "D:\\Selenium Auto\\selenium\\IEDriverServer_Win32_2.43.0\\IEDriverServer.exe");
driver = new InternetExplorerDriver();
step();
}
public static void step()
{
String testUrl = "http://baidu.com";
driver.get(testUrl);
driver.quit();
}
public static void chrome()
{
// WebDriver driver;
System.setProperty("webdriver.chrome.driver", "D:\\Selenium Auto\\selenium\\chromedriver.exe");
driver = new ChromeDriver();
String testUrl = "http://baidu.com";
driver.get(testUrl);
driver.quit();
}
public static void firefox()
{
// WebDriver driver;
//默认在C盘的安装路径
System.setProperty("webdriver.firefox.bin", "C:\\Program Files\\Mozilla Firefox\\firefox.exe");
//实例化
driver = new FirefoxDriver();
String testUrl = "http://baidu.com";
driver.get(testUrl);
driver.quit();
System.out.print("test");
}
}