Selenium Java Agent

Overview

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.

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 keyCreate API key

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:

-javaagent:/path/to/mabl-selenium-agent.jar=apiKey=[your-api-key]

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 imageRun configuration image

Run configuration image

Agent arguments

The agent accepts a number of parameters:

Name

Value

Required?

apiKey

mabl API key to use

Yes

httpProxy

Proxy to use to connect to mabl, specified as host:port

No

proxyUser

Username for proxy auth

No

proxyPassword

Password for proxy auth

No

name

The name to use when saving the test to mabl

No

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

-javaagent:/path/to/mabl-selenium-agent.jar=apiKey=your-api-key,httpProxy=proxy.example.com:8080,proxyUser=myuser,proxyPass=mypassword


Did this page help you?