且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在以MAC为中心和Windows为Nod的网格中运行chrome浏览器?

更新时间:2023-09-26 23:11:46

我有将Chrome浏览器从Mac机器运行到Windows Vista的解决方案 (将chromedriver下载并保存在Windows Vista计算机中)

I have solution to run Chrome browser from Mac machine to Windows Vista (download and save chromedriver in windows vista machine)

使用以下命令在Mac中启动集线器

Start the hub in Mac with below command

java -jar selenium-server-standalone-2.33.0.jar -role hub

使用以下命令在Windows中启动节点

Start the node in windows with below command

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中编写代码

Now write code in eclipse in Mac machine

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);