Quickstart

Follow these steps to add GPT Driver SDK to your existing Java Appium Driver codebase.

1

Add package dependency

In your pom.xml within dependencies add the GPT Driver dependency like this:

<dependencies>
    <dependency>
        <groupId>io.mobileboost.gptdriver</groupId>
        <artifactId>gptdriver-client</artifactId>
        <version>2.1.0</version>
    </dependency>
</dependencies>
2

Replace driver classes

Use the GPT Driver Subclasses to create the driver object. You can keep using the Appium Java client classes as driver type to minimize code changes.

AndroidDriver driver = new GptDriverAndroid(new java.net.URL("http://127.0.0.1:4723"), options);
3

Add apiKey in capabilities

In the options object which you pass to your driver, define the gptdriver:apiKey capability.

UiAutomator2Options options = new UiAutomator2Options();
options.setCapability("gptdriver:apiKey", "...");
4

Run tests & review self-healed locators

When running your test suite, all findElement(s) exceptions will be catched by GPT Driver and self-healed if possible.

You can view the debug logs of each exception and self-heal attempt on the GPT Driver sessions overview: https://app.mobileboost.io/gpt-driver/sessions

5

Disable self-healing in specific situations

If you want to disable self-healing for specific findElement commands you can do this by changing the type of your driver object to the GptDriver class. This will enable you to set a selfHealing parameter on the findElement(s) methods to false. e.g. when you want to perform a strict check at the end of a test.

GptDriverAndroid driver = new GptDriverAndroid(new java.net.URL("http://127.0.0.1:4723"), options);

// second parameter disables self healing
WebElement el = driver.findElement(By.id("successMessage"), false);

Assert.assertTrue(el.isDisplayed());

Please take a look at the Reference for a more complete overview of the SDK capabilities.

Last updated