SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

How To Configure Selenium Grid 2 Node To Run WebDriver Test

As described In my EARLIER POST, Selenium grid 2 Is useful to execute webdriver software tests on multiple nodes In parallel. So we need to set up selenium grid 2 nodes for webdriver software test execution. But before that, Your selenium grid hub should be configured and in running mode as described in my PREVIOUS POST. Now lets configure selenium grid 2 single node to execute webdriver software automation tests in parallel in selenium grid.

Note : Here we are configuring selenium grid node on same machine where selenium grid hub is running for your easy understanding. Later on we will learn how to configure hub and nodes on different machines and run software automation test on it.

What Is Node
Node is the point which accept test requests from hub and execute them. We can configure node in such a way to execute tests in parallel on different browsers at the same time. Also we can set max number of browsers allowed to run test at a time, timeout etc. in upcoming posts.

Registering Selenium Grid 2 Node To Hub
We need to register selenium grid node to hub so that hub can understand where to run software automation tests when receive request for test execution. But before that please read bellow given prerequisites.

Prerequisites :
  • Selenium grid hub should be In running mode as described In previous post.
  • "chromedriver.exe" file should be located in D: drive. It will be needed to run tests in google chrome browser. Read THIS POST to know from where to download it if you do not have "chromedriver.exe" file.
  • "IEDriverServer.exe" file should be located in D: drive. It will be needed to run tests in Internet explorer browser.Read THIS POST to know from where to download it if you do not have "IEDriverServer.exe" file.
  • Internet explorer browser's protected modes should be enabled for all zones as described in THIS POST and browser zoom level should be set to 100% as described in THIS POST.
Now follow the steps given bellow.
  1. Open another command prompt (Separate than hub command prompt).
  2. Navigate to D: drive by typing command D: in command prompt.
  3. Type bellow given command syntax in command prompt and press ENTER button.
java -jar selenium-server-standalone-2.52.0.jar -role node -Dwebdriver.ie.driver="D:/IEDriverServer.exe" -Dwebdriver.chrome.driver="D:/chromedriver.exe" -hub http://localhost:4444/grid/register -port 5566

Command elements
  • selenium-server-standalone-2.52.0.jar -> Selenium standalone server jar file. Modify It as per your jar file version in above command if it is not 2.52.0.
  • 5566 -> port number which will be used by node.
  • http://localhost:4444/grid/register : URL to register node where hub is running. Our current configuration is running hub and nodes on same machine so localhost in URL will work here. 
  • Note : If node Is running on different machine than the hub machine then you need to replace IP address of hub machine with "localhost" in above URL.
  • -Dwebdriver.ie.driver="D:/IEDriverServer.exe" : Set path of IEDriverServer.exe file for node to run test in internet explorer browser.
  • -Dwebdriver.chrome.driver="D:/chromedriver.exe" : Set path of chromedriver.exe file for node to run test in google chrome browser.
Note : Please restart hub and node if face any issue on any stage during test. To restart grid 2 node
  • Press CTRL+c keys of keyboard to shutdown node.
  • Run above command once again to register node with hub.
We can also configure how many browsers you need on specific node(Example : 2 Firefox, 3 chrome and 3 IE browsers) and max how many allowed browsers to run on specific node. We will learn it in upcoming posts.

Verify whether grid node is running fine
When you type above command In command prompt, It will show you message like "The node is registered to the hub and ready to use" as shown In bellow Image. That means you have configured node properly.


Now If you access URL : http://localhost:4444/grid/console. It will show you page like bellow.

You can see, there are different browsers like 1 IE, 5 Firefox and 5 chrome browsers which you can use to run your software automation test. Now, Selenium grid is ready to use where hub and one node are running on same machine.

Now supposing we have 1 test case and wants to execute it in parallel in different 3 browsers. Can we do it using this configuration? Answer is Yes.. View my NEXT POST to know how to do it using selenium grid 2.

2 comments:

  1. Hi Aravind.

    Thanks for your post.
    I use the latest 3.0.0-beta2 Selenium Standalone Server
    and when tried to run the node I got an error. See my CMD below. Do you know how to solve it?
    Thanks

    C:\>java -jar selenium-server-standalone-3.0.0-beta2.jar -role node -Dwebdriver.ie.driver="C:/IEDriverServer.exe" -Dwebdriver.chrome.driver="C:/chromedriver.exe" -hub http://localhost:4444/grid/register -port 5566
    Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -Dwebdriver.ie.driver=C:/IEDriverServer.exe
    at com.beust.jcommander.JCommander.parseValues(JCommander.java:742)
    at com.beust.jcommander.JCommander.parse(JCommander.java:282)
    at com.beust.jcommander.JCommander.parse(JCommander.java:265)
    at com.beust.jcommander.JCommander.(JCommander.java:210)
    at org.openqa.grid.selenium.GridLauncherV3$3.setConfiguration(GridLauncherV3.java:231)
    at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.java:130)
    at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:67)

    ReplyDelete
  2. I have same issue plz sort-out this issue.

    ReplyDelete