问题
I have set up 2 PCs as selenium hub & node.Now, I am trying to browse a URL in that node, from a console app that runs in the hub. But there is an error when initialising the browser.Both PCs run on windows 7.
//setting up the hub
Process.Start("cmd.exe", "/C java -jar selenium-server-standalone-2.47.1.jar -role hub");
//setting up the node
string Command1 = "/C cmdkey.exe /add:\\DES100 /user:abcd /pass:abcd123";
string Command2 = "psexec.exe \\DES100 -w D:\\Selenium java -Dwebdriver.chrome.driver=D:\\chromedriver.exe -jar selenium-server-standalone-2.47.1.jar -role node -hub http://hubip:4444/grid/register";
Process.Start("cmd.exe", string.Format("{0} && {1}", Command1, Command2));
//open the browser
//ERROR AT BELOW LINE
IWebDriver NewDriver = new RemoteWebDriver(new Uri("http://100.100.10.100:5555/wd/hub"), DesiredCapabilities.Chrome(),TimeSpan.FromSeconds(180));
ERROR The HTTP request to the remote WebDriver server for URL http://100.100.10.100:5555/wd/hub/session timed out after 180 seconds.
回答1:
You're string your grid on localhost:4444 and your webdriver URI is pointing to :5555
Its supposed to be:
IWebDriver NewDriver = new RemoteWebDriver(new Uri("http://100.100.10.100:4444/wd/hub"), DesiredCapabilities.Chrome(),TimeSpan.FromSeconds(180));
Also make sure that your grid is launched by above line of code by opening your browser and typing
MachineIP:4444
Also you need to learn command bread up.
Learn more about it selenium grid commands break ups
来源:https://stackoverflow.com/questions/32221291/unable-to-launch-chrome-in-remote-webdriver