We learnt what is Selenium Grid 2 and when to use it in PREVIOUS POST. Selenium Grid is another project of selenium so you need to configure selenium grid 2 from scratch to execute selenium webdriver software test cases parallel in grid. Let's try to configure selenium grid In single machine and then we will run selenium webdriver tests In It.
As described In my previous post, We need to setup one hub and multiple nodes (number of nodes depends on your requirement) to execute selenium webdriver software test cases parallel on selenium grid nodes.
What Is Hub?
What Is Hub?
In selenium grid, Hub is a central point which receive software test requests and send those software test requests to nodes for execution. In our case of selenium webdriver, When we start executing software test on selenium grid, Grid hub will receive and manage test requests and then send them to registered node machine. We can configure node on same machine or different machines too. We will learn more about nodes in upcoming post.
Setting Up Selenium Grid 2 Hub
To execute selenium webdriver test cases parallel In selenium grid, We need to set up selenium grid hub In your machine which will provide available capabilities and configuration to webdriver tests.
Step 1 : Download Selenium Standalone Server jar
You can download selenium standalone server from THIS PAGE.
Current latest version of selenium standalone server is 2.52.0 so you will get "selenium-server-standalone-2.52.0.jar" file. Put it in D: drive.
Note : If your selenium standalone server version is different than use that version number in all bellow steps. Otherwise it will not work for you.
Step 2 : Start Selenium Grid Hub
To start hub,
- Open command prompt
- Navigate to D: drive by typing command D: in command prompt.
- Type bellow given command syntax in command prompt and press ENTER button.
java -jar selenium-server-standalone-2.52.0.jar -port 4444 -role hub
- selenium-server-standalone-2.52.0.jar -> Selenium standalone server jar file version. Modify It as per your jar file version in above command if it is not 2.52.0.
- 4444 -> Port used by hub to listen nodes.
Note : Please restart hub and if face any issue on any stage during test. To restart grid 2 hub
- Press CTRL+c keys of keyboard to shutdown node.
- Run above command once again to register node with hub.
Verify whether grid hub is running fine
It will show you message -> "Selenium Grid hub is up and running." as shown in bellow image.
Now you can access selenium grid console using URL : http://localhost:4444/grid/console. Open this URL in any browser. It will show you page like bellow.
That means selenium grid hub is configured properly and ready to use. We will learn how to configure nodes for seleniun grid 2 hub in NEXT POST.