org.openqa.selenium.devtools.v85.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-v85 Show documentation
Show all versions of selenium-devtools-v85 Show documentation
Selenium automates browsers. That's it! What you do with that power is entirely up to you.
package org.openqa.selenium.devtools.v85.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 java.util.Map;
import java.util.LinkedHashMap;
import org.openqa.selenium.json.JsonInput;
@Beta()
public class Accessibility {
/**
* Disables the accessibility domain.
*/
public static Command disable() {
LinkedHashMap params = new LinkedHashMap<>();
return new Command<>("Accessibility.disable", Map.copyOf(params));
}
/**
* 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() {
LinkedHashMap params = new LinkedHashMap<>();
return new Command<>("Accessibility.enable", Map.copyOf(params));
}
/**
* 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) {
LinkedHashMap params = new LinkedHashMap<>();
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", Map.copyOf(params), ConverterFunctions.map("nodes", input -> input.readArray(org.openqa.selenium.devtools.v85.accessibility.model.AXNode.class)));
}
/**
* Fetches the entire accessibility tree
*/
@Beta()
public static Command> getFullAXTree() {
LinkedHashMap params = new LinkedHashMap<>();
return new Command<>("Accessibility.getFullAXTree", Map.copyOf(params), ConverterFunctions.map("nodes", input -> input.readArray(org.openqa.selenium.devtools.v85.accessibility.model.AXNode.class)));
}
}