Delete a Scan

Link to Delete a Scan copied to clipboard

Scans can accumulate pretty quickly while testing for accessibility. After sending a scan to the axe DevTools Mobile Dashboard and determining it's no longer needed, use the below API to remove the scan from the dashboard. The ability to remove results no longer necessary helps highlight the scans in the dashboard that require attention.

Deleting a scan is only supported within automated testing.

Delete a Scan from the Result Key

When pushing a scan to the dashboard, you'll get an AxeDevToolsResultKey object returned. On the initialized AxeDevTools object, use the key to remove the scan from the dashboard.

try axeDevTools?.deleteResult(resultKey)

Full Example

In this snippet, we'll remove the scan from the dashboard if zero failures were found.

func testAccessibility() throws {
    guard let result = try axe?.run(onElement: app), let resultKey = try axe?.postResult(result) else
    {
        XCTFail("Result Unavailable")
        return
    }
        
    if result.failures.count == 0 {
        try axe?.deleteResult(resultKey)
    } 
}