图解.NET自动化测试工具Selenium Grid使用
1、打开百度,找到Selenium Standalone Server官网地址,如下图所示:

3、找两台机器,虚拟机也可以。我这里用的是A:10.189.1.206,B:10.189.1.201。A作为Hub,B作为Node。
4、安装Hub:把下载的selenium-server-standalone-3.5.2.jar放在在A机器上,运行命令:java -jar selenium-server-standalone-3.5.2.jar -role hub如下图所示:

7、可以访问整个Grid的控制台:http://10.189.1.206:4444/grid/console/,如下图所示:

9、C#代码,创建控制台项目,添加Selen坡纠课柩ium引用,如下图所示:usingSystem;usingSystem.Co造婷用痃llections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingOpenQA.Selenium;usingOpenQA.Selenium.Remote;usingOpenQA.Selenium.Chrome;namespaceRunTestOnRemoteGrid{classProgram{staticvoidMain(string[] args){IWebDriver driver=newChromeDriver();try{driver =newRemoteWebDriver(newUri("http://10.189.1.206:4444/wd/hub"),newChromeOptions());driver.Navigate().GoToUrl("http://www.baidu.com");}catch(Exception ex){Console.WriteLine(ex.ToString());}finally{driver.Quit();}}}}

10、运行:就可以看到Client端在执行,没啥动作,而B机器上,打开了Chrome浏览器,访问Baidu。