
org.openqa.selenium.devtools.v95.accessibility.Accessibility Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-devtools-v95 Show documentation
Show all versions of selenium-devtools-v95 Show documentation
Selenium automates browsers. That's it! What you do with that power is entirely up to you.
The newest version!
package org.openqa.selenium.devtools.v95.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 for the root Document
*/
@Beta()
public static Command> getFullAXTree(java.util.Optional depth, java.util.Optional max_depth, java.util.Optional frameId) {
ImmutableMap.Builder params = ImmutableMap.builder();
depth.ifPresent(p -> params.put("depth", p));
max_depth.ifPresent(p -> params.put("max_depth", p));
frameId.ifPresent(p -> params.put("frameId", p));
return new Command<>("Accessibility.getFullAXTree", params.build(), ConverterFunctions.map("nodes", new com.google.common.reflect.TypeToken>() {
}.getType()));
}
/**
* Fetches a particular accessibility node by AXNodeId.
* Requires `enable()` to have been called previously.
*/
@Beta()
public static Command> getChildAXNodes(org.openqa.selenium.devtools.v95.accessibility.model.AXNodeId id, java.util.Optional frameId) {
java.util.Objects.requireNonNull(id, "id is required");
ImmutableMap.Builder params = ImmutableMap.builder();
params.put("id", id);
frameId.ifPresent(p -> params.put("frameId", p));
return new Command<>("Accessibility.getChildAXNodes", params.build(), ConverterFunctions.map("nodes", new com.google.common.reflect.TypeToken>() {
}.getType()));
}
/**
* Query a DOM node's accessibility subtree for accessible name and role.
* This command computes the name and role for all nodes in the subtree, including those that are
* ignored for accessibility, and returns those that mactch the specified name and role. If no DOM
* node is specified, or the DOM node does not exist, the command returns an error. If neither
* `accessibleName` or `role` is specified, it returns all the accessibility nodes in the subtree.
*/
@Beta()
public static Command> queryAXTree(java.util.Optional nodeId, java.util.Optional backendNodeId, java.util.Optional objectId, java.util.Optional accessibleName, java.util.Optional role) {
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));
accessibleName.ifPresent(p -> params.put("accessibleName", p));
role.ifPresent(p -> params.put("role", p));
return new Command<>("Accessibility.queryAXTree", params.build(), ConverterFunctions.map("nodes", new com.google.common.reflect.TypeToken>() {
}.getType()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy