Still now our main aim or goal to execute test script on the same machine where our script developed.But if we need to run the same test script on different environment(mainly the different version of browser we may also consider the different operating system) at the same time what we do? The answer is Selenium Grid.
Q1:Where we can find the Selenium Grid?
Ans: Selenium Grid is basically a jar file we can download this jar from here.
Q2:Which jar we need to run Selenium Grid?
Ans: After going to the above mentioned link we can find Download Version(Some version number) link under the Selenium Server(formerly the Selenium RC Server). After clicking to this link we can download the
selenium-server-standalone-2.41.0.jar file.The page looks like that
Q3:How many part we need to configure for Selenium Grid setup
Ans: Basically 2 part we need to configure for Selenium Grid set up
A.Hub
Hub will receive all requests and distribute them to the right nodes.basically it play the Server role.
B.Node
Node is playing as a client role
Q3:How to install or run this jar for hub role?
Ans: Just execute this command
java -jar "our selenium Grid directory\selenium-server-standalone-2.41.0.jar" -role hub
After executing this command command screen shows the details it looks like below
Some common problems to start the Hub and solutions
Problem1: java -jar not executed
Solution: Go to the installed location of the java bin folder from the command prompt and then execute the above mentioned command.
Problem2: Exception to bind the port
Solution:If we drill down the exception it clearly shows that Selenium Grid got this exception because default port (4444) is used by another process.To jump over this hurdle we just mention the free port with the command so it should be looks like that
java -jar "our selenium Grid directory\selenium-server-standalone-2.41.0.jar" -role hub -port FreePortNumber
How we know that which ports are using currently?
Ans: Execute the below command from the command prompt by which we can get the details of the all process and port
netstat -a -n -o
So we take any port except those ports are listed into the command prompt.
Problem 3: FireWall block this port which we try to open?
Ans: Allow or unblock the port from FireWall ,if there is no security problem then off the FireWall.
After successfully start the hub we can find the webpage which looks like below if we hit the url:
http://localhost:portnumber(this is for local machine from where we execute the command to start the hub) or http://hubmachineIP:portnumber
In the below example we hit the url from the local machine
Q4:How to run or install the jar for the client role?
Ans: Execute this command
java -jar "our selenium Grid directory\selenium-server-standalone-2.41.0.jar" -role node -hub http://our hub machine ip or localhost:portnumber/grid/register
After successfully executing the command, command line screen should be looks like that
Some common problems to start the Node and solutions
Problem1: Exception to bind the port means that it is already in use
Solution:If we drill down the exception it clearly shows that Selenium Grid got this exception because default port (5555) is used by another process.To avoid this problem we just mention the free port with the command so command should be looks like that
java -jar "our selenium Grid directory\selenium-server-standalone-2.41.0.jar" -role node -hub http://hub machine IP or localhost:portnumber/grid/register -port FreePortNumber
There are lots of optional parameter we can pass to the node when we required it like
borwsername: -browser browserName=firefox
plantform: platform=WINDOWS
maxInstances: maxInstances=5
version: version=29.0.1
firefox_binary firefox_binary=our firefox binary path
port -port 4444
e.g:
java -jar "our selenium Grid directory\selenium-server-standalone-2.41.0.jar" -role node -hub http://hub machine IP or localhost:portnumber/grid/register -port FreePortNumber -browser browserName=firefox platform=WINDOWS
Q1:Where we can find the Selenium Grid?
Ans: Selenium Grid is basically a jar file we can download this jar from here.
Q2:Which jar we need to run Selenium Grid?
Ans: After going to the above mentioned link we can find Download Version(Some version number) link under the Selenium Server(formerly the Selenium RC Server). After clicking to this link we can download the
selenium-server-standalone-2.41.0.jar file.The page looks like that
Q3:How many part we need to configure for Selenium Grid setup
Ans: Basically 2 part we need to configure for Selenium Grid set up
A.Hub
Hub will receive all requests and distribute them to the right nodes.basically it play the Server role.
B.Node
Node is playing as a client role
Q3:How to install or run this jar for hub role?
Ans: Just execute this command
java -jar "our selenium Grid directory\selenium-server-standalone-2.41.0.jar" -role hub
After executing this command command screen shows the details it looks like below
Some common problems to start the Hub and solutions
Problem1: java -jar not executed
Solution: Go to the installed location of the java bin folder from the command prompt and then execute the above mentioned command.
Problem2: Exception to bind the port
Solution:If we drill down the exception it clearly shows that Selenium Grid got this exception because default port (4444) is used by another process.To jump over this hurdle we just mention the free port with the command so it should be looks like that
java -jar "our selenium Grid directory\selenium-server-standalone-2.41.0.jar" -role hub -port FreePortNumber
How we know that which ports are using currently?
Ans: Execute the below command from the command prompt by which we can get the details of the all process and port
netstat -a -n -o
So we take any port except those ports are listed into the command prompt.
Problem 3: FireWall block this port which we try to open?
Ans: Allow or unblock the port from FireWall ,if there is no security problem then off the FireWall.
After successfully start the hub we can find the webpage which looks like below if we hit the url:
http://localhost:portnumber(this is for local machine from where we execute the command to start the hub) or http://hubmachineIP:portnumber
In the below example we hit the url from the local machine
Q4:How to run or install the jar for the client role?
Ans: Execute this command
java -jar "our selenium Grid directory\selenium-server-standalone-2.41.0.jar" -role node -hub http://our hub machine ip or localhost:portnumber/grid/register
After successfully executing the command, command line screen should be looks like that
Some common problems to start the Node and solutions
Problem1: Exception to bind the port means that it is already in use
Solution:If we drill down the exception it clearly shows that Selenium Grid got this exception because default port (5555) is used by another process.To avoid this problem we just mention the free port with the command so command should be looks like that
java -jar "our selenium Grid directory\selenium-server-standalone-2.41.0.jar" -role node -hub http://hub machine IP or localhost:portnumber/grid/register -port FreePortNumber
There are lots of optional parameter we can pass to the node when we required it like
borwsername: -browser browserName=firefox
plantform: platform=WINDOWS
maxInstances: maxInstances=5
version: version=29.0.1
firefox_binary firefox_binary=our firefox binary path
port -port 4444
e.g:
java -jar "our selenium Grid directory\selenium-server-standalone-2.41.0.jar" -role node -hub http://hub machine IP or localhost:portnumber/grid/register -port FreePortNumber -browser browserName=firefox platform=WINDOWS
No comments:
Post a Comment