- 下载 selenium-server-standalone-3.4.0.jar包
- 在selenium-server-standalone-3.4.0.jar包目录下面执行cmd 命令 java -jar selenium-server-standalone-3.4.0.jar -role hub 启用selenium grid hub, 默认端口 4444
- 注册浏览器客户端,命令行执行:java -Dwebdriver.ie.driver="D:\AutoConf\bin\IEDriverServer.exe" -jar selenium-server-standalone-3.4.0.jar -role node -hub http://localhost:4444/grid/register 启用了一个端口为5555 的node
- selenium 脚本代码
DesiredCapabilities capability = DesiredCapabilities.internetExplorer();capability.setBrowserName("internet explorer" );capability.setPlatform(Platform.VISTA);
try { driver = new RemoteWebDriver(new URL("http://10.118.164.104:5555/wd/hub"), capability);} catch (MalformedURLException e) { e.printStackTrace();}
时间: 2024-10-05 00:08:11