iOS Test Example with XCUITest Driver

Link to iOS Test Example with XCUITest Driver copied to clipboard
Free Trial

Be sure to checkout the full Appium setup guide with axe DevTools Mobile if you're just getting started.

XCUITest Driver Example with Python Tests

While the below example is written in Python, the logic is transferable to other Appium client libraries.

from appium import webdriver
from appium.options.ios import XCUITestOptions
from appium.webdriver.appium_connection import AppiumConnection

class DemoWithAxeDevToolsMobile:

    def setup(self):
        success = True
        desired_caps = {}
        # Add your required capabilities for testing:
        desired_caps['platformName'] = 'iOS'
        desired_caps['automationName'] = 'XCUITest'

        # Add axe DevTools Mobile required capabilities for testing:
        desired_caps['bundleId'] = "com.bundle.identifier"

        # Initialize Appium Server Connection
        options = XCUITestOptions().load_capabilities(desired_caps)
        self.driver = webdriver.Remote('http://localhost:4723', options=options)

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

demo = DemoWithAxeDevToolsMobile()

# Navigate To Screen

# Navigate To Another Screen