1

I want to study how to run same test at same time on two computers. I've done everything that is explained in this tutorial. I have PC, where I set hub:

java -jar selenium-server-standalone-2.37.0.jar -role hub

And I have notebook, where is node:

java -jar selenium-server-standalone-2.37.0.jar -role webdriver -hub http://192.168.0.50:4444/grid/register -port 5566

So here is my code:

public class Driver
{
    IWebDriver _driver = new ChromeDriver(@"C:\Program Files (x86)\ChromeDriver\");

    public string BaseUrl, NodeUrl;
    [SetUp]
    public void Setup() 
    {
        BaseUrl = "http://google.com/";
        NodeUrl = "http://192.168.0.66:5566/wd/hub";
        DesiredCapabilities capability = DesiredCapabilities.Chrome();
        capability.SetCapability(CapabilityType.BrowserName, "chrome");
        capability.SetCapability(CapabilityType.Platform, "VISTA");
        _driver =  new RemoteWebDriver(new Uri(NodeUrl), capability);
    }

    [TearDown]
    public void Teardown()
    {
        _driver.Quit();
    }
    [Test]
    public void SimpleTest()
    {
        _driver.Navigate().GoToUrl(BaseUrl);
        Assert.AreEqual("Google", _driver.Title);
    }
}

When I run test in VS2012, it gives me following error:

SetUp : System.InvalidOperationException : The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://code.google.com/p/chromedriver/downloads/list

I searched. People gave advice to add environment variable from Control Panel in Windows. I did.

webdriver.chrome.driver C:\Program Files (x86)\ChromeDriver\chromedriver.exe

That didn't help me. Same error. I searched more. Next advice was to set this variable when I configure hub. Like this:

java - jar selenium-server-standalone-2.37.0.jar webdriver.chrome.driver="C:\Program Files(x86)\ChromeDriver\chromedriver.exe" -role hub

This also doesn't help. What should I do?

1 Answer 1

1

IT should be

java - jar selenium-server-standalone-2.37.0.jar -Dwebdriver.chrome.driver="C:\Program Files(x86)\ChromeDriver\chromedriver.exe" -role hub

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you for respond. I did, same error. Should I use -Dwebdriver.chrome.driver="C:\Program Files(x86)\ChromeDriver\chromedriver.exe" only when I register hub or when node too?
Yeah, thanks. It works. I add -webdriver.chrome.driver="C:\Program Files(x86)\ChromeDriver\chromedriver.exe" when I register node.
I have another question. How to run mulltiple browsers with this test on my node? I add --maxSession 10, but it doesn't work. Only 1 browser doing my test on the node.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.