Selenium Grid is known as part of a selenium suite running multiple tests all over the different browsers, operating systems and machines in parallel. It will be achieved by tracking the commands of remote browser instances where a server acts like a hub. A user needs to configure the remote server where in order to execute the tests.
Selenium Grid is divided as Grid 1 and Grid 2.
When we should use selenium grid?
We have to use the selenium grid when we do the following
- Run our tests against different browsers, operating systems and machines all time. This will make sure that the application you are testing will be fully compatible with all the wide range of browser OS.
- This saves time in the execution of all the test suites. The setup of Selenium Grid to run, 4 tests we can finish entire suit around 4 faster.
Selenium Grid architecture:
Selenium Grid is having a Hub and Node Architecture
The Hub
- The hub is that central point where we load our tests into.
- There also should only be one hub in an exceedingly grid.
- This hub is launched on a single machine whose OS is windows 7 and whose browser is IE.
- The tests will be executed on the machine containing the hub. Browser is automated on the node.
The Node
- Here the nodes will be the selenium instances which may execute the tests and it is loaded on the hub.
- where it can may be often or more nodes in the grid
- Nodes are going to be launched on many different machines with various platforms and browsers
- The machines running the nodes that require not be the identical platform because as the hub.
The Selenium Grid by Command Line
We can place the selenium server.jar file our hard drive. The .jar file is placed in the C drive of both machine A and machine B during Selenium Grid installation. Below are the steps to launch the hub and the node.
We are now visiting to the launch a hub. Go to Machine A using command prompt navigate to root of Machine A’s-C drive because that is directory where we placed the selenium server. We can write on the command prompt java-jar selenium server standalone 2.3.0.jar role as hub. The hub is launched in command prompt.
There are many to verify whether the hub will be running is by using a browser. Selenium Grid will uses Machines A’s 4444 for its web interface. We should write the address http://localhost:4444/grid/console t. This checks if any Machine B will be working the hub’s web interface by launching browser where there is “iporhostnameofmachineA” is the IP address of machine where the hub is running. Machine A’s InternetProtocol address is 192.168.1.3 then the browser Machine B may use http://192.168.1.3:4444/grid1/console.
The hub prior setup in that place we are going to launch a node. As we launch in Machine B and we can use in a command prompt there transfer to the root of Drive C and write code below. We used the IP address 192.168.1.3 in that place where the hub is running. We used port 5566 when we choose any free port number.
java -Dwebdriver.gecko.driver=”C:\geckodrive1r.exe” -jar selenium-server-standalone-3.4.0.jar -role webdriver -hub http://192.168.1.3:4444/grid1/register -port 5566.
enter in our command prompt will be similar to the image.
We have to go to the selenium grid and the interface and also refresh the page we should have
Questions:
- What is Selenium Grid? Why it is used
- What is Selenium Grid Architecture?