I searched for an answer to my question here and on the web but couldn't find anything that was helpful to me. Hopefully this isn't too dumb of a question.
I'm trying to get Selenium 2 to work using various browsers. I am using a Mac as a hub and a node and a Windows pc as a node. My problem is with Chrome. I want to initiate the Java code on the Mac and have the Selenium tests run on the Windows pc. To get Chrome to run on localhost I have the following code:
System.setProperty("webdriver.chrome.driver", "Users/xxxxx/chromedriver");
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com");
This opens up Chrome on the hub/node Mac. How do I get it to open up on the Windows PC? Can I pass anything into the ChromeDriver() class?
I've tried using RemoteWebDriver, and have the following:
System.setProperty("webdriver.chrome.driver", "/Users/xxxxx/chromedriver");
DesiredCapabilities cap = DesiredCapabilities.chrome();
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:9515/wd/hub), cap);
driver.get("http://www.google.com");
The code compiles and executes, but Chrome never comes up. I don't get any errors. Note that I'm initiating the RemoteWebDriver on localhost and Chrome still doesn't work. Nothing changes if I change the URL to the IP of the Windows PC. I'm either doing something wrong with the RemoteWebDriver or I need to pass parameters to ChromeDriver. Please help.
Found the answer after a bit more searching. Turns out that the URL of the remotewebdriver needed to be only localhost:9515
without /wd/hub
. Also, if running on another machine, make sure to start up chromedriver on that machine and point webdriver.chrome.driver
to the location of chromedriver.