Continuum for Python

Getting Started

Setup

First, you’ll want to import Continuum and invoke its set_up method:

from continuum import Continuum
continuum = Continuum()
continuum.set_up(driver, '/path/to/continuum.json')

Set the first parameter to the instance of Selenium WebDriver to use for testing. Set the second parameter to the absolute path of a valid continuum.json file. Here’s what a basic continuum.json file looks like, taken from one of our Continuum sample projects:

{
  "accessEngineType": "professional",
  "accessibilityConcerns": {
    "includePotentialConcerns": false,
    "format": "amp"
  },
  "proxy": {
    "host": null,
    "port": null,
    "username": null,
    "password": null
  },
  "defaultStandardIds": [
    610, /* WCAG 2.0 Level A */
    611, /* WCAG 2.0 Level AA */
    612, /* WCAG 2.0 Level AAA */
    1387, /* WCAG 2.1 Level A */
    1388, /* WCAG 2.1 Level AA */
    1389, /* WCAG 2.1 Level AAA */
    1140, /* Section 508 and 255 (Revised 2017) */
    1471 /* WCAG 2.0 Level A & AA Baseline */
  ],
  "includePotentialAccessibilityConcerns": false,
  "ampInstanceUrl": "https://amp.levelaccess.net",
  "ampApiToken": null,
  "levelAccessPlatform": {
    "orgInstanceUrl":    null,
    "apiKey":            null,
    "workspaceId":       null,
    "digitalPropertyId": null,
    "scanTagId":         null
  }
}

For more information, refer to our documentation for the set_up method.

The same instance of WebDriver and Continuum can be reused across multiple tests to cut down on initialization time. If for some reason you need to switch out drivers, remember to invoke Continuum’s set_up method again, passing in the new driver.

Usage

At this point, Continuum is initialized and good to go. You can now use Selenium however you’d like, e.g. by using the driver you created to navigate to a particular URL that you’d like to test for accessibility:

driver.get('http://www.google.com')

Once you’ve navigated to the page you’d like to test, invoke the appropriate Continuum method (all of which execute synchronously). For example, to run all available accessibility tests against the entirety of the current page (this example is for getting the results in AMP concerns format):

accessibility_concerns = continuum.run_all_tests()

Run the following command to get results in assertions format that can be sent to Platform:

assertions = continuum.run_all_tests_for_assertions()

You can then do whatever you like with any accessibility concerns or assertions returned, like print them out to the console, filter them for only the ones you’re interested in, etc. Check out our documentation for the AccessibilityConcern class for a complete list of what’s returned for each accessibility concern. For assertions please check out our documentation for the Assertion class for a complete list of what gets returned for each accessibility assertion.

Other Continuum methods are available that allow you to only run particular tests or test against specific best practices. Continuum also allows you to only test a particular part of a page rather than the entire page. All of these methods are detailed in our documentation for the Continuum class. You have the power!

Support

Questions can be emailed to Level Access support at support@levelaccess.com.

Indices and tables