All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openqa.selenium.devtools.accessibility.Accessibility Maven / Gradle / Ivy

Go to download

Selenium automates browsers. That's it! What you do with that power is entirely up to you.

There is a newer version: 4.0.0-rc-1
Show newest version
package org.openqa.selenium.devtools.accessibility;

import org.openqa.selenium.Beta;
import org.openqa.selenium.devtools.Command;
import org.openqa.selenium.devtools.Event;
import org.openqa.selenium.devtools.ConverterFunctions;
import com.google.common.collect.ImmutableMap;
import org.openqa.selenium.json.JsonInput;

@Beta()
public class Accessibility {

    /**
     * Disables the accessibility domain.
     */
    public static Command disable() {
        ImmutableMap.Builder params = ImmutableMap.builder();
        return new Command<>("Accessibility.disable", params.build());
    }

    /**
     * Enables the accessibility domain which causes `AXNodeId`s to remain consistent between method calls.
     * This turns on accessibility for the page, which can impact performance until accessibility is disabled.
     */
    public static Command enable() {
        ImmutableMap.Builder params = ImmutableMap.builder();
        return new Command<>("Accessibility.enable", params.build());
    }

    /**
     * Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.
     */
    @Beta()
    public static Command> getPartialAXTree(java.util.Optional nodeId, java.util.Optional backendNodeId, java.util.Optional objectId, java.util.Optional fetchRelatives) {
        ImmutableMap.Builder params = ImmutableMap.builder();
        nodeId.ifPresent(p -> params.put("nodeId", p));
        backendNodeId.ifPresent(p -> params.put("backendNodeId", p));
        objectId.ifPresent(p -> params.put("objectId", p));
        fetchRelatives.ifPresent(p -> params.put("fetchRelatives", p));
        return new Command<>("Accessibility.getPartialAXTree", params.build(), ConverterFunctions.map("nodes", new com.google.common.reflect.TypeToken>() {
        }.getType()));
    }

    /**
     * Fetches the entire accessibility tree
     */
    @Beta()
    public static Command> getFullAXTree() {
        ImmutableMap.Builder params = ImmutableMap.builder();
        return new Command<>("Accessibility.getFullAXTree", params.build(), ConverterFunctions.map("nodes", new com.google.common.reflect.TypeToken>() {
        }.getType()));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy