Selenium对应的Driver下载及对应版本
谷歌浏览器ChromeDriver下载地址:
http://npm.taobao.org/mirrors/chromedriver/

其中查看版本对应关系,版本目录下的notes.txt中查看:

火狐浏览器FirefoxDriver下载地址:
https://github.com/mozilla/geckodriver/releases
其中要求的浏览器版本及selenium包版本,如下:

IE浏览器IEDriver下载地址:
https://www.nuget.org/packages/Selenium.WebDriver.IEDriver/

Selenium下载地址:
https://www.seleniumhq.org/download/
其中官网下载页面有关于不同浏览器Driver文件下载地址链接:

Selenium Grid分布式部署测试:
通过设置Hub点,作为与具体脚本执行的节点协调通讯;Node节点,作为脚本执行的具体平台,操作系统,浏览器,及浏览器版本等设置不同,检验测试系统兼容性。同时与TestNG框架集成,可以一个Node节点并行运行测试脚本,提高效率。
设置Hub,Windows环境下,cmd命令窗口切换到Selenium包所在目录下,执行命令:
java -jar selenium-server-standalone-3.x.x.jar -role hub -maxSession 10 -port 4444
其参数表示:
-role hub表示启动运行hub;
-port是设置端口号,hub的默认端口是4444,这里使用的是默认的端口,当然可以自己配置;
-maxSession为最大会话请求,这个参数主要要用并发执行测试用例,默认是1,建议设置10及以上。
设置node节点:
java -jar selenium-server-standalone-2.53.1.jar -role node -port 6666 -hub http://192.168.0.245:4444/grid/register -Dwebdriver.chrome.driver=chromedriver.exe -maxSession 5 -browser browserName=chrome,seleniumProtocol=WebDriver,maxInstances=5,platform=WINDOWS
其中参数表示:
-role node:表示启动的是node节点
-port 5555:指定node节点端口
-hub http://192.168.0.245:4444/grid/register:表示hub机地址
-maxSession 5:node节点最大会话请求
-browser browserName=firefox,seleniumProtocol=WebDriver,
maxInstances=5,platform=WINDOWS,version=45.0.2
注:需要在node物理机器,有放置各种需要的浏览器Driver 文件,且cmd窗口切换到Selenium目录下
管理node节点
DesiredCapabilities capability = new DesiredCapabilities();
//设置启动浏览器类型,根据不同的浏览器Hub指挥对应的note节点执行脚本
capability.setBrowserName("chrome");
//设置note节点的操作系统
capability.setPlatform(Platform.WINDOWS);
try {
//其中URL为note节点所在物理IP地址,
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
driver.get("http://www.baidu.com");
driver.quit();
} catch (MalformedURLException e) {
e.printStackTrace();
}

待持续完善......