Skip to content

Selenium grid

Bernd Weigel edited this page Jun 10, 2024 · 15 revisions

Selenium Grid is a web driver over network adapter. Basically it allows your test case to use a web browser that runs on another machine. So you don't need to have any browser you want to use within your tests to be installed on the test execution machine, you can just build your own browser cloud.

In order to get that cloud running you need to start a server (called hub in Selenium) on an machine. You also need to have at least one node that is registered to the hub and provides at least one browser configuration.

With our multi browser support you annotate the required web browser on your test and Neodymium takes care of the web browser's lifecycle. To get that running in combination with Selenium grid you need to set up the grid by following this quick start guide. After that you need to create an entry in file config/credentials.properties that describes the access to your hub. Finally you need to set the testEnvironment property for the browser configuration

Example

config/credentials.properties

In that example the Selenium grid is available via https://192.168.1.101:4444 in the local network and will be referenced with myGrid

# example configuration 'myGrid'
browserprofile.testEnvironment.myGrid.url = https://192.168.1.101:4444
browserprofile.testEnvironment.myGrid.username = 
browserprofile.testEnvironment.myGrid.password = 
config/browser.properties

Please note the reference to 'myGrid' that is configured above

# latest Firefox in 1600x1200 
browserprofile.FF_1600x1200.name = Firefox 1600x1200
browserprofile.FF_1600x1200.browser = Firefox
browserprofile.FF_1600x1200.browserResolution = 1600x1200
browserprofile.FF_1600x1200.testEnvironment = myGrid
MyTests.java

The following example class uses the browser that is configured to run in 'myGrid'

@Browser("FF_1600x1200")
public class MyTests
{
    @NeodymiumTest
    public void testMethod()
    {
        Selenide.open("www.google.com");
    }
}

Block diagram Selenium Grid
+----------+            +----------------------------------------------+
|          |    Uses    | +-------+                                    |
| Selenium | +--------> | |       |                                    |
|          |            | |  Hub  +-----+---------+-------------+      |
+----------+            | |       |     |         |             |      |
                        | +-------+  +--+---+  +--+---+       +-+----+ |
                        |            |      |  |      |       |      | |
                        |            | Node |  | Node |  ...  | Node | |
                        |            |      |  |      |       |      | |
                        |            +------+  +------+       +------+ |
                        |                                              |
                        +----------------------------------------------+

Clone this wiki locally