selenium 远程调用浏览器
共分三步:
1.selenium官网下载selenium-server-standalone.jar的最新版本号
2.启动selenium-server::::: java -jar "selenium-server-standalone-2.2.0.jar"
-Dwebdriver.firefox.bin="C:\FirefoxCollection\Mozilla Firefox 36.0\firefox.exe"
3.java代码初始化webdriver对象时:
DesiredCapabilities
capabilities = new DesiredCapabilities("firefox", "", Platform.ANY);
driver=new RemoteWebDriver(new URL("http://127.0.0.1:4444/wd/hub/"),capabilities);
Ps:假设是调用本地的浏览器的话,
System.setProperty("webdriver.firefox.bin", "F:\\InstalledFiles\\firefox\\firefox.exe");
WebDriver driver = new FirefoxDriver(); 就可以