I’m running a test:
DesiredCapabilities capability = DesiredCapabilities.Firefox();
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capability);
ISelenium selenium = new WebDriverBackedSelenium(driver, "http://localhost/");
selenium.Start();
This runs the Firefox browser, and in the http://localhost:4444/grid/console web console view I can see that one Firefox browser is running. How can I use more than one browser on the node in parallel?
I’m using the Grid2 wiki page found here
You need to trigger 5 tests simultaneously – all pointing to the same hub, to use all the browsers. On receiving the commands from different tests, hub would pass those commands to RCs matching the capability. You can see more details in this page : http://selenium-grid.seleniumhq.org/how_it_works.html.
Per this site:-
EDIT:
The above given site was for Selenium 1.x version and not for Grid 2.0. However, the underlying concept for running parallel tests remains the same
EDIT2:
Steps and example programs are below. Please note that this is a very basic test ONLY to show you how Grid runs tests in parallel.
Step1 – Start Grid Hub
java -jar selenium-server-standalone.jar -role hubStep2 – Start RC nodes. The tests which we are using for example are webdriver tests. So we need to start webdriver nodes. This command would start a webdriver node which supports 5 firefox browsers, 5 googlechrome and 1 IE browser. This is the default config for webdriver.
Step 3- Create 5 separate programs similar to the one given below. This program is in JAVA. You need to change it to the language you need. Change class name to Program2,Program3 etc. As mentioned earlier, this is not the best way to run tests in parallel. You need to use testNG or jUnit to trigger multiple tests at the same time. Since that is a different topic by itself am not going to explain it here.
Step 4 – Run all 5 programs simultaneously.
Step 5 – Watch the grid doing the magic of running 5 tests in parallel. 🙂