5
http://code.google.com/p/selenium/wiki/Grid2

i run selenium hub with

java -jar ..\DLL\Selenium\selenium-server-2.1.0\selenium-server-standalone-2.1.0.jar -role hub

but then i do not know how to run 3 selenium browsers.

i try like

DesiredCapabilities capability = DesiredCapabilities.Firefox();
capability.SetCapability(CapabilityType.Platform, "WINDOWS");
capability.SetCapability(CapabilityType.BrowserName, "firefox");
capability.SetCapability(CapabilityType.Version, "5.0");

IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capability);

ISelenium selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost/");
selenium.Start();

but on driver object i get this error: cannot find : {platform=WINDOWS, browserName=firefox, version=5.0}

there is so bad docs on this how to run 3 selenium browser in paralell.

Thx

1 Answer 1

3

You need to launch the RC node after launching the hub. You can use the command:

java -jar selenium-server-jar -role rc (OR -role wd - depending upon whether you need webdriver or remotecontrol) -hub http://localhost:4444/grid/register

This will launch the RC node with default capability of running 5 firefox browsers, 5 googlechrome and 1 IE browser.

You can check the grid console to make sure your RC got registered. Grid console URL will be http://localhost:4444/grid/console. Hover your mouse on top of each of the browser icon to find the browsername which you should use inside the code and to find other properties of browser.

If you are trying to run the existing selenium 1 tests in Grid 2.0 you don't need the capability matcher. You just need to have

ISelenium selenium = new DefaultSelenium("localhost", 4444, "firefox", "http://localhost/");
selenium.Start();

Note that there is no * with browsername.

If you are planning to use webdriver to run the tests in grid, then you need to modify your code like:

DesiredCapabilities capability = DesiredCapabilities.Firefox();
capability.SetCapability(CapabilityType.Platform, "WINDOWS");
capability.SetCapability(CapabilityType.BrowserName, "firefox");
capability.SetCapability(CapabilityType.Version, "5.0");

IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capability);

ISelenium selenium = new WebDriverBackedSelenium(driver,"baseURL");
selenium.Start();

Documentation on how to start the nodes can be found here and how to use remotewebdriver can be found here

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

4 Comments

i am using selenium serve 2.2. What is better to use? Here said wd: seleniumhq.org/docs/…
Execution speed would be better in webdriver. If you are starting from scratch go with webdriver. Having said that, there is an existing issue with Grid 2.0 and webdriver combination which causes tests to fail intermittently. Issue 2037
i get the same error with webdrive like issue 2037. But this is old issue from jul 12, 2011 and no solution yet? So i must use RC? Is better to use selenium grid1?
Per the reporter of Issue 2037, this issue is happening for RC as well. Whether to use grid1 due to this issue - depends on your urgency to get the tests stabilized. My tests are currently on grid1 and am holding from migrating to Grid 2.0 due to this issue.

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.