Migrate Appium Plugin to 2.0.0

Link to Migrate Appium Plugin to 2.0.0 copied to clipboard

Guide to migrate early adopters to the latest changes of axe DevTools Mobile for Appium.

Free Trial

Note: If you are just getting started with axe DevTools Mobile for Appium, head over to the setup guide.

Thanks for the feedback! We made some changes to our Appium Plugin to better serve you and how you're testing mobile apps today. If you have implemented version 1.0.0 of the Appium Plugin, follow this guide for easy steps in switching to 2.0.0.

Update to version 2.0.0

Uninstall axeDevToolsMobile:

appium plugin uninstall axeDevToolsMobile

A fresh install of the plugin will grab the newest version. Install the plugin to your Appium instance through the command line:

appium plugin install --source=npm @axe-devtools/appium-plugin

Update Capabilities

From your Appium automation scripts, copy then remove the 'key' capability previously required for axe DevTools Mobile's API key.

The API key will move to a settings object to be passed into Appium's executeScript method.

tip

You may consider adding a utility function to your testing script as a central place to initiate an accessibility scan.

Update How to Scan for Accessibility Issues

Previously, the plugin intercepted Appium's page source method to check for accessibility issues. This has been replaced so that page source is still available to use in tests as you have been previously!

Anywhere you'd like to initiate an accessibility test, replace instances of calling the page source API with execute script API.

executeScript("axe:scan", Settings)

Param Type Description
Settings Object Includes the required configurations for axe DevTools Mobile. (See Required Keys in Settings).
PageSource String Optional: If you've already grabbed the PageSource for the current screen, you can provide it to axe DevTools Mobile without incurring that query cost again. Note: If you find that the screenshot and results are not matching in the dashboard, the PageSource may be stale and shouldn't be used.

Required Keys in Settings

Key Type Description
apiKey String Required by Deque to provide access to authorized users. Access your axe DevTools Mobile API Key in the axe Account portal.

Examples

Here's an example of the changes highlighted above. Full examples are available in other client languages.

Example in Python

def runAccessibilityScan(self):
    settings = {}
    settings['apiKey'] = "<your-api-key-here>"
    return self.driver.execute_script('axe:scan', settings)

Example with PageSource in Python

def runAccessibilityScan(self):
    settings = {}
    settings['apiKey'] = "<your-api-key-here>"
    pageSource = self.driver.page_source
    return self.driver.execute_script('axe:scan', settings, pageSource)