What Is Selenium Grid?
Selenium Grid is a testing tool which allows you to run your tests on different machines against different browsers. It is a part of the Selenium Suite which specializes in running multiple tests across different browsers, operating systems, and machines. You can connect to it with Selenium Remote by specifying the browser, browser version, and operating system you want through Selenium Remote’s Capabilities.
There are two main elements to Selenium Grid: a hub and nodes.
What is a Hub?
In Selenium Grid, the hub is a computer which is the central point where we can load our tests. The hub also acts as a server, so it acts as a central point to control the network of test machines. The Selenium Grid has only one hub and it is the master of the network.
When a test with the relevant Desired Capabilities is given to the hub, it searches for the node which matches the given configuration. For example, you could say that you want to run the test on Windows 10 and Chrome browser with any version. The hub will try to find a machine in the Grid which matches this criteria and will run the test on that machine. If there is no match, the hub returns an error. There should be only one hub in a Grid.
What Is a Node?
In Selenium Grid, a node is a test machine which opts to connect with the hub. This test machine will be used by the hub to run tests on. A Grid network can have multiple nodes. A node is supposed to have different platforms, i.e. a different operating system and browsers. The node does not need the same platform for running as that of the hub.
How does Selenium Grid work?
First, you need to create a hub. Then you can connect (or register) nodes to that hub. Nodes are where your tests will run, and the hub is responsible for making sure your tests end up on the right node (e.g., the machine with the operating system and browser you specified in your test).
(Click to enlarge.)
Before configuring Selenium Grid in Provar you should have already sorted your Selenium Grid setup and have your Selenium Grid URL ready for use in Provar’s setup. Some basic information on Selenium Grid is added below but please refer to Selenium Grid’s documentation for more information on completing this setup.
Starting a Hub
Open the command prompt and navigate to the drive where Selenium Server is placed. Normally on Windows this is under C:\Drive.
On the command prompt, type:
java -jar selenium-server-standalone-3.141.59.jar -role hub
To verify whether the hub is running, open the browser and navigate to “http://localhost:4444”
Now click the Console link and then click View Config. The config of the hub should be displayed as below.
Setting up the node machine
To register the hub machine with the node machine, go the command prompt and type.
java -jar selenium-server-standalone-3.141.59.jar -role node
It should show as follows.
After executing the command, return to the hub and navigate to the URL http://localhost:4444 where you will be able to see all the web browsers.
If you want to run test cases, leave this open so you can monitor progress. Remember that you must have a host and node running in order to run Provar test cases on Selenium Grid. If you do not have these running, an error message will be thrown.
Configuring Selenium Grid in Provar
To begin configuring Selenium Grid in Provar, start by adding a new Browser Provider. This will help to run Provar tests on Selenium Grid using the supported browsers (Chrome, Safari, Edge, Firefox and Internet Explorer).
Navigate to the Test Settings view and click the Browser Providers tab.
Then click the Add New (‘+’) button:
On the Add new Browser Provider screen, make sure that the Selenium Grid radio button is selected:
Add a Provider Name and a Selenium Grid URL to connect to host, for example:
Use the Test Connection button to verify the server details.
Next, add the Browsers that will be used by clicking the ‘Add New’ (+) button on the Browsers section.
On the Add Selenium Grid Browsers page, first select the Platform where testing is going to be carried out. (You can ignore the Browser Name as this will be prepopulated based on your other selections.) The available platforms are provided as a dropdown based on the platforms assigned to the relevant Selenium Grid account.
Once you have selected the Platform, you can choose the Web Browser and Browser Version.
Note that, for Browser Version, any is also an option.
Once you are happy with the device details provided, click the OK button.
Back on the Browser Provider details screen, it should now appear as follows:
Click the OK button to finish adding the new Browser Provider.
Now that you have added a new Browser Provider for Selenium Grid, you should see this reflected on the Browser Providers tab.
Running tests on Selenium Grid
Run and debug mode execution
To start running test cases on Selenium Grid, first select the new Web Browser which you created above.
This can also be set for a particular test case by using the Web Browser Override on the test’s Connection step.
Then click Run or Debug to run the test.
In the host you opened above, it will show the information to initiate a session with the desired capabilities and it will assign a node to the session.
And in Node it will display the information required node is assigned to the session with desired capability.
Provar will then run the test with the defined web browser configuration.
Progress can be monitored as usual in the Test Runner.
Run under ANT execution
Provar also provides Run under ANT execution for Selenium Grid.
To select this, right-click on the test(s) or folder and select Run Under ANT.
In the ANT Dialog, select the new Web Browser you created above:
This will add the following parameters to the Build.xml file.
Running this file will initiate the session/run in a similar way to the Run and Debug mode sessions above.
In Host it will show the information to initiate a session with the desired capabilities and it will assign a node to the session.
In Node it will display the information required node is assigned to the session with desired capability.
The ANT HTML report will appear as follows.
Selenium Grid execution will work as normal when there are proxies defined under Provar Network Settings, or defined under the Desired Capability of the Browser Provider as a ‘proxyURL’ (see below).
Note that, if proxy information is set up at both levels, Provar will give preference to the proxy information in the Desired Capability setting in the Browser Provider.
To add a proxy at the Browser Provider level, open the Browser Provider in edit and go to the Desired Capabilities section.
Click the Add New (‘+’) icon.
On the Add new desired Capabilities screen, enter a Name of proxyURL and the value.
Then click OK.
Once added, use the Test Connection button to make sure the connection is working as expected.
If there is any proxy present during execution, an entry will be made in the hub.
The following limitations currently exist in Provar’s implementation of Selenium Grid.
Accessing Chrome profiles
Normally, when Provar’s test execution happens locally, Provar users can specify the Google Chrome profile that should be used in the execution. This is not supported when executing tests over Selenium Grid as the execution will be happening at the remote node. Due to this limitation, you’ll need to re-provide a password and verification token when executing over Selenium Grid, or your IP will need to be whitelisted. Salesforce should know from where the request is coming so it can provide login access to execute the tests.
Accessing locally stored files
Normally Provar allows you to download a file locally to perform actions such as assertions. This is not supported when executing tests on Selenium Grid because the remote node will not be able to access the locally downloaded file, so any tests which use locally downloaded files will not run successfully.
If you are affected by either of these limitations please contact Provar support directly for advice.
- General information
- Licensing Provar
- Provar trial guide and extensions
- Using Provar
- API testing
- Behavior-driven development
- Creating and importing projects
- Creating test cases
- Custom table mapping
- Debugging tests
- Defining a namespace prefix on a connection
- Defining proxy settings
- Environment management
- Exporting test cases into a PDF
- Exporting test projects
- Managing test steps
- Namespace org testing
- Provar desktop
- Provar Test Builder
- Refresh and Recompile
- Reload Org Cache
- Running tests
- Searching Provar with find usages
- Secrets management and encryption
- Setup and teardown test cases
- Tags and Service Level Agreements (SLAs)
- Test cycles
- Test plans
- Testing browser options
- Tooltip testing
- Using the Test Palette
- Test Palette introduction
- Control test steps
- List compare
- Read test step
- String test steps
- UI Test Steps
- Using custom APIs
- Callable tests
- Data-driven testing
- Page objects
- Block locator strategies
- Introduction to XPaths
- Creating an XPath
- Label locator strategies
- Maintaining page objects
- Mapping non-Salesforce fields
- Page object operations
- Refresh and reselect field locators in Test Builder
- Using Java method annotations for custom objects
- Applications testing
- Database testing
- Document testing
- Email testing
- Mobile testing
- OrchestraCMS Testing
- Salesforce CPQ testing
- ServiceMax testing
- Skuid testing
- Vlocity testing
- Webservices testing
- Introduction to test scheduling
- Apache Ant
- Configuration for sending emails via the Provar Command Line Interface (CLI)
- Continuous integration
- Azure DevOps
- Running a Provar CI task in Azure DevOps
- Configuring the Provar secrets password in Microsoft Azure Pipelines
- Parallel execution in Microsoft Azure Pipelines using multiple build.xml files
- Parallel execution in Microsoft Azure Pipelines using targets
- Parallel execution in Microsoft Azure Pipelines using Test Plans
- Bitbucket Pipelines
- GitHub Actions
- Running a Provar CI task in GitHub Actions
- Remote Trigger in GitHub Actions
- Parameterization using Environment Variables in GitHub Actions
- Parallel Execution in GitHub Actions using multiple build.xml files
- Parallel Execution in GitHub Actions using Targets
- Parallel Execution in GitHub Actions using Test Plan
- Parallel Execution in GitHub Actions using Job Matrix
- GitLab CI
- Travis CI
- Execution Environment Security Configuration
- Parallel Execution
- Running Provar on Linux
- Salesforce DX
- Team foundation server
- Version control
- Zephyr Cloud and Server
- Salesforce testing
- Adding a Salesforce connection
- Assert Page Error Messages on Add/Edit Product
- Dynamic Forms
- Internationalization support
- List and table testing
- Salesforce Release Updates
- Salesforce Lightning Testing
- Salesforce Lightning Web Component (LWC) locator support
- Salesforce console testing
- Visualforce Testing
- Performance Best Practices
- Testing best practices
- Configurations and permissions
- Error messages
- Administrator has blocked access to client
- macOS Big Sur upgrade issue
- Resolving failed to create ChromeDriver error
- Resolving Jenkins license missing error
- Resolving metadata timeout errors
- Test execution fails – Firefox not installed
- Update to Opportunity field validation behaviour
- Licensing, installation and firewalls
- Test Builder and test cases
- Release notes
- Version 2.7.0 Summer ’22
- Version 2.6.3
- Version 2.6.0 Spring ’22
- Version 2.5.0 Winter ’22
- Version 2.4.1
- Version 2.4.0 Summer ’21
- Version 2.3.1
- Version 2.3.0 Spring ’21
- Version 2.2.1
- Version 2.2.0 Winter ’21
- Version 2.1.1
- Version 2.1.0 Summer ’20
- Version 2.0.5
- Version 2.0.4
- Version 2.0.3 Spring ’20
- Version 1.9.12
- Version 1.9.11