集线器:MAC 64位地址:Windows 32位
无法使用Selinum网格MAC作为集线器和Windows(点头)运行chrome浏览器?
使用以下代码我遇到了错误(驱动程序可执行文件的路径必须由webdriver.chrome.driver系统属性设置;有关更多信息,请参见http://code.google.com/p/selenium/wiki/ChromeDriver。可以从http://code.google.com/p/chromedriver/downloads/list下载最新版本命令持续时间或超时:668毫秒)
public void chromeWindows() throws MalformedURLException{
System.setProperty("webdriver.chrome.driver", "/Users/vinayakkhatate/Desktop/jar/chromedriver2");
ChromeOptions opt = new ChromeOptions();
opt.setBinary("C:/Users/user/AppData/Local/Google/Chrome/Application/chrome.exe");
DesiredCapabilities capabilies = DesiredCapabilities.chrome();
capabilies.setBrowserName("chrome");
capabilies.setPlatform(Platform.VISTA);
driver = new RemoteWebDriver(new URL("http://10.0.11.118:5566/wd/hub"), capabilies);
driver.get(baseUrl);
System.out.println(driver.getTitle());
driver.close();
driver.quit();
}
我有将Chrome浏览器从Mac机器运行到Windows Vista的解决方案(将chromedriver下载并保存在Windows Vista机器中)
使用以下命令在Mac中启动集线器
java -jar selenium-server-standalone-2.33.0.jar -role hub
使用以下命令在Windows中启动节点
java -jar selenium-server-standalone-2.33.0.jar -role node -hub http://localhost:4444/grid/register -maxSession 15 -browser browserName="chrome",version=ANY,platform=WINDOWS,maxInstances=5 -Dwebdriver.chrome.driver=pathtochromedriver\chromedriver.exe
现在在Mac机器中的eclipse中编写代码
DesiredCapabilities capabilies = DesiredCapabilities.chrome();
capabilies.setBrowserName("chrome");
capabilies.setPlatform(Platform.ANY);
driver = new RemoteWebDriver(new URL("http://<ip address of windows machine>:5555/wd/hub"), capabilies);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句