Migrate Java test to Java Appium Client 9.2.2 or above

Java Appium Client (java-client) 9.2.2 or above introduces several changes that may cause the following issues with automation testing:

  • Authentication Issue: The Appium Java Client 9.2.2 no longer includes authentication (username and key) in API requests by default. This change means credentials aren’t being transmitted as they were in previous versions.

  • Capabilities Issue: The library now defaults to using firstMatch capabilities instead of the alwaysMatch or desiredCapabilities that Kobiton system expects.

To successfully migrate Java test scripts using lower 'java-version' versions to 9.2.2 or above, the following changes are required:

  • Remove the username and API key from the Appium request.

  • Provide the username and accessKey capabilities for authentication.

Update Java test script for migration

Standalone/On-Prem customers with version 4.15S or below must update to 4.16.1S before migrating to Appium Java Client 9.2.2 or above.
  1. Open the Java test script for editing.

  2. Remove the username and API key from Kobiton Appium server’s URL (kobitonServerUrl).

    • Cloud and Hybrid

    • Standalone/On-Prem

    Examples
    // Before editing
    String kobitonServerUrl = "https://johndoe:301***8-6**3-42ab-8**1-d87cc*****3@api.kobiton.com/wd/hub";
    
    // After editing
    String kobitonServerUrl = "https://api.kobiton.com/wd/hub";
    Examples
    // Before editing
    String kobitonServerUrl = "http[s]://johndoe:301***8-6**3-42ab-8**1-d87cc*****3@[Portal server hostname or IP]:3000/wd/hub";
    
    // After editing
    String kobitonServerUrl = "http[s]://[Portal server hostname or IP]:3000/wd/hub";
  3. Add 2 new capabilities username and accessKey into the list of capabilities.

    Examples
    capabilities.setCapability("appium:username","johndoe");
    
    capabilities.setCapability("appium:accessKey","301***8-6**3-42ab-8**1-d87cc*****3");
  4. Run the script to verify the authentication.