Ranorex 7 has a brilliant new feature of being able to execute web tests against remote machines using Selenium Server. This allows us to execute tests in parallel against multiple browsers and on various platforms (Linux, Windows, Mac).
For those of you that are using Ranorex but haven’t set up a remote Selenium server, here is a simple guide to get you going.
In this example we are just using 2 PCs.
PC1 – This is the PC with Ranorex installed (IP: 10.0.0.37)
PC2 – This is the remote machine, which acts as both the Selenium Hub and has a Selenium Node (IP: 10.0.0.152)
So first of all we need to understand what the difference is between the Selenium Hub and the Selenium Node. The Selenium Hub (Server) acts as the controller that receives requests to execute tests on certain platforms & browsers, and then re-directs them to the appropriate Node that matches the request. So we have one Hub and we register multiple Nodes to the Hub, each Node could be a physical or virtual machine (creating a Grid of remote machines to execute tests against).
For this demo we are just using 2 physical machines, one with Ranorex on, and the other which will take both roles of Hub and Node.
Step 1: On our remote PC, we need to download Java JRE and install it. We used JRE 1.8.0_121, downloaded from here
You can check it is installed correctly by opening a command prompt and typing java -version
Step 2: On our remote PC, we need to download the following files from SeleniumHQ :
- Selenium Server (we used selenium-server-standalone-3.3.1.jar for our demo)
Just extract these files into a folder such as documents/SelServer
Step 3: On our remote PC, add the directory that you put the selenium server and browser server files in step 2, to the system path.
On the remote machine, open the System Contol Panel (Control Panel->System and Security->System) and click the Advanced system settings link on the left. On the System Properties dialog that appears, on the Advanced tab, click the Environment Variables… button.
Now select the Path variables in the system variables and click Edit… Click the New button and add the path to the directory from Step 2.
Step 4: On our remote PC, start Selenium Hub running.
Open a command window, change directory to the selenium server directory (on ours it was cd C:\Users\edgewords\Documents\SelServer)
Now start the Selenium Server, type the following and hit enter:
java -jar selenium-server-standalone-3.3.1.jar -role hub
The hub should now be running on localhost port 4444
Step 5: On our remote PC, register a Node to the Hub
Open another command prompt window and add a node to the hub:
java -jar selenium-server-standalone-3.3.1.jar -role node -hub http://localhost:4444/grid/register
We can check this has worked now by opening a web browser and going to: http://localhost:4444/grid/console
you should see the following:
Step 6: On our Ranorex PC, we can now connect to the remote Selenium Hub and execute our Web Tests.
In Ranorex 7, Add an End Point (our remote Selenium Hub). From the main Ranorex menu choose View->End Points, and click the Add Endpoint button.
And complete the details. Remember – your remote machine (Hub) IP address will be different so find out your Selenium Hub IP address on the remote machine by opening a command prompt and typing ipconfig and enter key
If connected successfully you should see the new endpoint. You can now click the icon to the left of it as highlighted below to direct Ranorex replay to that endpoint.
Now go ahead and run your web tests remotely!
Edgewords Training is a dedicated Automated Testing Tools training company. We are a Ranorex Training Partner, and provide training in Ranorex, Selenium, Cucumber, SpecFlow, HP Tools, JMeter and many other tools.