Python Error Handling
How to work around errors caused by axe DevTools Python 4.3
Version 4.3.0 and above of the axe DevTools integrations use a new technique when calling
Axe#analyze() which opens a new window at the end of a run. Many of the issues outlined in this document address common problems with this technique and their potential solutions.
An example error message for this problem will include a message about
(node:17566) UnhandledPromiseRejectionWarning: Error: Malformed type for "handle" parameter of command switchToWindow Expected: string Actual: undefined
Popup blockers prevent us from opening the new window when calling
Axe#analyze() . The default configuration for most automation testing libraries should allow popups. Please make sure that you do not explicitly enable popup blockers which may cause an issue while running the tests.
If for some reason you are unable to run the new
Axe#analyze() technique without errors, axe provides a new chainable method that allows you to run the legacy version of
Axe#analyze(). When using this method axe excludes accessibility issues that may occur in cross-domain frames and iframes.
Axe#set_legacy_mode() is deprecated and will be removed in v5.0. Please report any errors you may have while running
Axe#analyze() so that they can be fixed before the legacy version is removed.
from axe_devtools_api import Axe driver = ... # open webdriver and go to your page results = Axe(driver).set_legacy_mode().analyze()