selenium+eclispse里代码备注

1、火狐、谷歌和IE浏览器引擎都要重新下载selenium官网引擎,并设置路径才可以支持selenium3

而狐火用自己的引擎不用设置路径既可以支持selenium2也支持selenium3,谷歌和IE就不行

package Testpakage;

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

public class Mytest {
public static void main(String[] args) {

System.setProperty("webdriver.gecko.driver", "C:\\Users\\Administrator\\Downloads\\geckodriver-v0.8.0-win32\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();

// System.setProperty("webdriver.ie.driver", "C:\\Program Files\\Internet Explorer\\IEDriverServer.exe");
// WebDriver driver=new InternetExplorerDriver();
//
// System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\Google\\Chrome\\Application\\chromedriver.exe");
// WebDriver driver=new ChromeDriver();

driver.get("https://www.baidu.com/");
driver.quit();
}
}

posted @ 2016-10-22 21:57  Halo3224  阅读(939)  评论(0编辑  收藏  举报
热爱技术的小牛