Git Product home page Git Product logo

axe-core-maven-html's Introduction

axe-core Selenium (Java) Integration

CircleCI

This example demonstrates how to use axe to run web accessibility tests in Java projects with the Selenium browser automation tool and Java development tools.

Selenium integration enables testing of full pages and sites.

Requirements

To run the example

  1. Move to the axe-core-maven-html directory.
  2. node src/test/resources/test-app.js to start the fixture server.
  3. mvn test to build and run the JUnit tests that drive Selenium against the fixture.

This should launch an automated Chrome window, load and analyze the configured web pages, and then pass/fail a JUnit test depending on whether there are any accessibility violations detected.

To modify the example

To run the example tests on your own web page, change the URL passed to driver.get in ExampleTest.setUp().

To use the AXE helper library in your own tests

Include this library as a test-scoped dependency in your POM. Ensure the version matches the one in [pom.xml](./pom.xml):

<dependency>
    <groupId>com.deque.html.axe-core</groupId>
    <artifactId>selenium</artifactId>
    <version>3.1-SNAPSHOT</version>
    <scope>test</scope>
</dependency>

The AxeBuilder type is the main interface. Pass it a Selenium WebDriver instance, configure it, and run the analyze method to get results.

  • options wires a JSON string to axe, allowing rules to be toggled on or off. See the testAccessibilityWithOptions unit test for a sample single-rule execution, and the axe-core API documentation for full documentation on the options object. The runOnly option with tags may be of particular interest, allowing axe to execute all rules with the specified tag(s).
  • include adds to the list of included selectors. If you do not call include at all, axe will run against the entire document.
  • exclude adds to the list of excluded selectors. Exclusions allow you to focus scope exactly where you need it, ignoring child elements you don't want to test.
  • withOptions takes an options object to be passed to the axe.run call.
  • withTags limits rules run to those that match specified tags.
  • withOnlyRules limites rules run to those specified.
  • disabledRules disables rules.
  • analyze executes axe with any configuration you have previously defined. If you want to test one or more WebElements, you may pass them into analyze instead of using include and exclude.

Contributing

In order to contribute, you must accept the contributor licence agreement (CLA). Acceptance of this agreement will be checked automatically and pull requests without a CLA cannot be merged.

Deployment (Maintainers Only)

This package is deployed to Maven Central via OSSRH. To deploy this package, follow these instructions on StackOverflow.

Additionally add your OSSRH credentials to your ~/.m2/settings.xml file as such:

<servers>
  <server>
    <id>ossrh</id>
    <username>YOUR_OSSRH_JIRA_USERNAME</username>
    <password>YOUR_OSSRH_JIRA_PASSWORD</password>
  </server>
</servers>

axe-core-maven-html's People

Contributors

adnoc avatar akornmeier avatar dependabot-preview[bot] avatar dmfay avatar dsturley avatar jeeyyy avatar logan-lim avatar osandadeshan avatar renatoi avatar scurker avatar stasek avatar stephenmathieson avatar wilcofiers avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.