Selenium Java Agent


The Selenium Agent is a JVM agent which is loaded at runtime and intercepts RemoteWebDriver method invocations to translate Selenium actions to mabl actions. No code changes are necessary when using this method. It is only necessary to load the mabl Selenium Agent by passing a JVM argument when you execute your Java Selenium Tests.


Supported Selenium versions

The Selenium Java Agent currently supports only Selenium 3.x. Other versions may work with the Selenium proxy method described in Java migration using Selenium proxy

Obtain an API key

When using the Java Selenium Agent, the first step is to obtain an API key for your workspace. Open the mabl application in your browser, and navigate to Settings => APIs. Click the Create API Key button, and then select Java Selenium Agent as the key type. Enter a name for the key, such as Selenium Migration, and then click the Create button.


Create API key

Download the agent

Next, download the mabl Selenium Agent jar file from here. Place this jar file in a location such as C:\mabl\mabl-selenium-agent.jar on Windows or ~/mabl/mabl-selenium-agent.jar on Linux/Mac.

Execute Selenium tests with the agent enabled

To migrate your Java Selenium tests, run your tests as you normally would but with an extra JVM argument:


For example, if you execute your tests using an IDE like Eclipse, create/edit a Run Configuration and add the agent to the JVM arguments:


Run configuration image


When using Java 16 or newer

If your JVM is version 16 or newer you will need to add additional VM arguments in the same location where the -javaagent argument is specified:

--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/

Without these arguments you will see an error similar to the following:

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private java.util.Spliterator accessible: module java.base does not "opens" to unnamed module

Agent arguments

The agent accepts a number of parameters:

apiKeymabl API key to useYes
httpProxyProxy to use to connect to mabl, specified as host:portNo
proxyUserUsername for proxy authNo
proxyPasswordPassword for proxy authNo
nameThe name to use when saving the test to mablNo

Parameters are passed as comma-delimited key-value pairs. The following is an example showing how to pass multiple arguments to the agent: