Run a Scan
Ready, set, scan
When you initialize the Axe DevTools mobile library, you pass settings into the axeStartSession method. This is where you provide credentials, indicate any rules you wish to ignore, and declare your intent to upload results to Axe Developer Hub or to only save results locally.
// Once per test run
await driver.execute('mobile: axeStartSession', {
apiKey: "<DEQUE_APIKEY>",
projectId: "<DEQUE_PROJECT_ID>",
ignoreRules: ['ColorContrast'],
axeUploadResults: true
// Note: Results are uploaded to Axe Developer Hub by default;
// you can omit this value or set to `false` to only save results locally
});Activate the accessibility scan at any point in your tests. When you're ready to kick off an accessibility scan, call the Execute Script API, passing in axeScan.
// Per screen
driver.execute('mobile: axeScan')Input
| Param | Type | Description |
|---|---|---|
| scanName | String |
Optional. Names the scan in Axe Developer Hub and on local results. |
Troubleshooting
Required session settings are passed to the axeStartSession call, once per test run. The scan call only accepts an optional scan name. If you passed an old setting to axeScan, note the following:
- On iOS, old settings on
axeScanare silently ignored. - On Android, passing an old setting to
axeScanthrows from the call and the test fails.
You may consider adding a utility function to your testing script as a central place to initiate an accessibility scan.
