Search code examples
javaseleniumselenium-webdriverwebdriverselenium-grid

Is it possible to register a custom webdriver in a Selenium grid?


I created a custom webdriver (for a custom browser) by extending RemoteWebDriver. I can easily use it as standalone, by simply instantiating the driver.

But actually I want to use it in a Selenium Grid. Is there a way to register this custom web driver on a node, so that I can use it with via RemoteWebDriver and desired capabilities? I so, what do I need to do.

Any hint is welcome. Thanks in advance.


Solution

  • Please follow the below set of instructions to setup support for a custom browser type when running selenium tests against a Selenium Grid.

    1. Implement the interface org.openqa.selenium.remote.server.DriverProvider (or) extend org.openqa.selenium.remote.server.DefaultDriverProvider wherein you take care of building support for your custom browser.
    2. Create a directory named META-INF\services under your main resources folder and ensure that this directory gets bundled into the jar, when you create a jar out of your project.
    3. Create a service loader file named org.openqa.selenium.remote.server.DriverProvider wherein you add the fully qualified class name of the new class you created in step (1) and place it in the directory created in step (2)
    4. Bundle your project into a jar.
    5. Now start the selenium node by adding the jar created in (4).

    Now your new browser is ready to be supported by the Selenium Grid.

    Please refer to this selenium-users google forums thread which also talks about the same query wherein the user confirmed that the above mentioned approach worked for them.

    You still need to take care of creating a new custom capabilities object from your client side when you instantiate the RemoteWebDriver object for your custom browser.