码迷,mamicode.com
首页 > 其他好文 > 详细

selenium 远程调用浏览器

时间:2015-06-23 10:17:53      阅读:328      评论:0      收藏:0      [点我收藏+]

标签: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(); 即可

selenium 远程调用浏览器

标签:selenium远程调用浏览器

原文地址:http://blog.csdn.net/wwhrestarting/article/details/46598235

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!