chrome.automation(自动化)
Description
chrome.automation
API 允许开发人员访问浏览器的自动化(可访问性)树。该树类似于 DOM 树,但仅暴露页面的语义结构。它可用于通过检查名称、角色和状态、侦听事件以及在节点上执行操作,以编程方式与页面交互。
Manifest Keys
必须在清单中声明以下键才能使用此 API。automation
Availability
Dev channel
Summary
Types
Methods
Types
ActionType
可以在自动化节点上执行的所有可能的操作。
TYPE
"annotatePageImages", "blur", "clearAccessibilityFocus", "collapse", "customAction", "decrement", "doDefault", "expand", "focus", "getImageData", "getTextLocation", "hideTooltip", "hitTest", "increment", "internalInvalidateTree", "loadInlineTextBoxes", "replaceSelectedText", "resumeMedia", "scrollBackward", "scrollDown", "scrollForward", "scrollLeft", "scrollRight", "scrollUp", "scrollToMakeVisible", "scrollToPoint", "setAccessibilityFocus", "setScrollOffset", "setSelection", "setSequentialFocusNavigationStartingPoint", "setValue", "showContextMenu", "signalEndOfTest", "showTooltip", "startDuckingMedia", "stopDuckingMedia", or "suspendMedia"
AriaCurrentState
指示 ARIA 当前状态。
TYPE
"false", "true", "page", "step", "location", "date", or "time"
AutomationEvent
PROPERTIES
eventFrom
string
此事件的来源。
intents
与此事件关联的
automation.AutomationIntent
列表。mouseX
number
与此事件关联的任何鼠标坐标。
mouseY
number
target
事件所针对的
automation.AutomationNode
。type
事件的类型。
stopPropagation
function
停止进一步处理此事件,除了任何剩余的侦听器
automation.AutomationEvent.target
.The
stopPropagation
function looks like:() => {...}
AutomationIntent
PROPERTIES
command
与此 AutomationIntent 关联的命令。
moveDirection
与此 AutomationIntent 关联的移动方向。
textBoundary
与此 AutomationIntent 关联的文本边界。
AutomationNode
PROPERTIES
accessKey
string optional
激活此小部件的键。
activeDescendant
AutomationNode optional
aria-activedescendant
引用的节点,如果适用activeDescendantFor
AutomationNode[] optional
活动后代的反向关系。
anchorAffinity
string optional
树选择锚点的亲和力,如果有的话。
anchorObject
AutomationNode optional
树选择的锚节点,如果有的话。
anchorOffset
number optional
树选择的锚点偏移量(如果有)。
appId
string optional
以该节点为根的树的应用程序 ID。
ariaColumnCount
number optional
此表中的列数由页面作者指定。
ariaCurrentState
AriaCurrentState optional
表示咏叹调当前状态。
ariaInvalidValue
string optional
aria-invalid 属性的值,表示错误类型。
ariaRowCount
number optional
此表中由页面作者指定的行数。
autoComplete
string optional
咏叹调自动完成。
backgroundColor
number optional
此子树的 RGBA 背景颜色,作为整数。
bold
boolean
表示节点文本为粗体。
busy
boolean optional
实时区域或任何其他元素的 aria-busy 值。
caretBounds
Rect optional
屏幕坐标中的当前插入符边界。
checked
string optional
三态描述复选框或单选按钮:'false' | 'true' | 'mixed'
checkedStateDescription
string optional
复选框状态的描述。仅在节点可检查时使用。
children
Walking the tree.
className
string optional
编程支持对象的名称。
color
number optional
此子树的 RGBA 前景色,作为整数。
colorValue
number optional
值为颜色的输入元素的 RGBA 颜色。
containerLiveAtomic
boolean optional
如果此节点位于活动区域内,则为 aria-atomic 的值。
containerLiveBusy
boolean optional
如果此节点位于活动区域内,则为 aria-busy 的值。
containerLiveRelevant
string optional
如果此节点位于活动区域内,则为 aria-relevant 的值。
containerLiveStatus
string optional
如果此节点位于活动区域内,则活动区域的类型。
controlledBy
AutomationNode[] optional
控件的反向关系。
controls
AutomationNode[] optional
指定此节点通过
aria-controls
控制的节点(如果有)。customActions
CustomAction[] optional
一系列自定义操作。
defaultActionVerb
DefaultActionVerb optional
通过调用
doDefault
执行的操作。describedBy
AutomationNode[] optional
节点,如果有的话,构成该节点的描述。
description
string optional
节点的目的,除了角色,如果有的话。
descriptionFor
AutomationNode[] optional
描述的反向关系。
details
AutomationNode[] optional
提供有关当前节点的更多详细信息的节点。
detailsFor
AutomationNode[] optional
反转关系详解。
detectedLanguage
string optional
此子树的检测到的语言代码。
display
string optional
此节点的 CSS 显示属性(如果适用)。
docLoaded
boolean optional
此文档是否已完成加载。
docLoadingProgress
number optional
此文档已完成加载的比例(超过 1.0)。
docTitle
string optional
本文档的标题。
docUrl
string optional
此文档的 URL。
errorMessage
AutomationNode optional
为当前节点提供错误消息的节点。
errorMessageFor
AutomationNode[] optional
errorMessage 的反向关系。
firstChild
AutomationNode optional
flowFrom
AutomationNode[] optional
flowTo 的反向关系。
flowTo
AutomationNode[] optional
节点(如果有),可以选择在此节点之后导航到这些节点。参见
aria-flowto
。focusAffinity
string optional
树选择焦点的亲和力"affinity",如果有的话。
focusObject
AutomationNode optional
树选择的焦点节点,如果有的话。
focusOffset
number optional
树选择的焦点偏移量(如果有)。
fontFamily
string
表示字体系列。
fontSize
number optional
表示该节点的字体大小。
hasPopup
HasPopup optional
指示交互式弹出元素的可用性和类型。
hierarchicalLevel
number optional
标题或树项的级别。
htmlAttributes
object optional
包含所有 HTML 属性及其值的地图
htmlTag
string optional
此元素的 HTML 标记(如果此节点是 HTML 元素)。
imageAnnotation
string optional
图像节点的图像注释,可以是人类可读的字符串,是上下文注释或与注释相关的状态字符串。
imageDataUrl
string optional
包含此对象图像或缩略图内容的数据 url。
inPageLinkTarget
AutomationNode optional
页内链接的目标。
indexInParent
number optional
此节点在其父节点的子节点列表中的索引。如果这是根节点,这将是未定义的。
innerHtml
string optional
此元素的内部 html。仅填充数学内容。
inputType
string optional
文本字段的输入类型,例如“文本”或“电子邮件”。
invalidState
InvalidState optional
表示无效状态。
isButton
boolean
此节点是否为按钮。
isCheckBox
boolean
此节点是否为复选框。
isComboBox
boolean
此节点是否为组合框。
isImage
boolean
此节点是否为图像。
isRootNode
boolean
此 AutomationNode 是否为根节点。
isSelectionBackward
boolean optional
如果存在选择,则选择的锚点是否位于可访问性树中的焦点之后。
italic
boolean
表示节点文本为斜体。
labelFor
AutomationNode[] optional
labelledBy 的反向关系。
labelledBy
AutomationNode[] optional
构成该元素标签的节点(如果有)。通常,来自这些元素的文本也将通过
automation.AutomationNode.name
属性作为元素的可访问名称公开。language
string optional
作者为此子树提供的语言代码。
lastChild
AutomationNode optional
lineThrough
boolean
表示节点文本是直通的。
liveAtomic
boolean optional
实时区域的 aria-atomic 值。
liveRelevant
string optional
实时区域的 aria-relevant 值。
liveStatus
string optional
如果这是活动区域的根,则为区域类型。可能的值是“
polite
(礼貌?)”和“assertive
(自信)”。location
Rect optional
此节点在全局屏幕坐标中的渲染位置(作为边界框)。
markers
Marker[] optional
此节点的 Marker 对象数组。
maxValueForRange
number optional
此范围的最大可能值。
minValueForRange
number optional
此范围的最小可能值。
modal
boolean optional
将此子树标记为模态。
name
string optional
此节点的可访问名称,通过可访问名称计算过程, Accessible Name Calculation。
nameFrom
NameFromType optional
名字的来源。
nextFocus
AutomationNode optional
nextOnLine
AutomationNode optional
nextSibling
AutomationNode optional
nonAtomicTextFieldRoot
boolean
指示对象是否用作公开其后代的文本字段。用例包括内容可编辑区域的根、当前不可编辑且具有交互式后代的 ARIA 文本框,以及“设计模式design-mode设置为“开启on”的元素。
nonInlineTextWordEnds
number[] optional
节点名称中每个单词的结束索引。这与 wordEnds 不同,因为它不限于内嵌文本框并且可以用于任何类型的元素。
nonInlineTextWordStarts
number[] optional
节点名称中每个单词的起始索引。这与 wordStarts 不同,因为它不限于行内文本框并且可以用于任何类型的元素。
notUserSelectableStyle
boolean optional
表示节点被标记为 user-select:none
parent
AutomationNode optional
placeholder
string optional
此文本字段的占位符(如果有)。
posInSet
number optional
集合中项目的从 1 开始的索引。
previousFocus
AutomationNode optional
previousOnLine
AutomationNode optional
previousSibling
AutomationNode optional
restriction
string optional
输入限制,如果有,例如只读或禁用:未定义 - 启用控件或其他未禁用的对象 Restriction.DISABLED - 本身不允许输入 + 任何后代 Restriction.READONLY - 允许焦点/选择但不允许输入
role
RoleType optional
此节点的作用。
roleDescription
string optional
此节点的角色描述。
root
AutomationNode optional
包含此 AutomationNode 的树的根节点。
scrollX
number optional
可滚动的容器属性。
scrollXMax
number optional
scrollXMin
number optional
scrollY
number optional
scrollYMax
number optional
scrollYMin
number optional
scrollable
boolean optional
指示此节点是否可滚动。
selected
boolean optional
指示此节点是被选中、未选中还是两者都不选中。
selectionEndAffinity
string optional
树选择结束的亲和性affinity,如果有的话。
selectionEndObject
AutomationNode optional
树选择的选择结束节点,如果有的话。
selectionEndOffset
number optional
树选择的选择结束偏移,如果有的话。
selectionStartAffinity
string optional
树选择的亲和性affinity开始,如果有的话。
selectionStartObject
AutomationNode optional
树选择的选择开始节点,如果有的话。
selectionStartOffset
number optional
树选择的选择开始偏移量(如果有)。
sentenceEnds
number[] optional
节点名称中每个句子的结尾索引。对于大多数节点,sentenceStarts 数组的大小应该等于sentenceEnds 数组的大小。两个例外是 (1) 节点在段落的开头,但节点的句子的结尾在其下一个节点中。这样的节点还有一个起始索引。(2) 节点在段落的末尾,但节点的句子的开头在其前一个节点。这样的节点还有一个结束索引。例如,Hello world.有两个节点。第一个有一个开始索引(即 0)但没有结束索引。第二个节点有一个结束索引(即 7)但没有开始索引。
sentenceStarts
number[] optional
节点名称中每个句子的起始索引。
setSize
number optional
集合中的项目数;
sortDirection
此节点的排序方向。
standardActions
ActionType[] optional
此节点上可用的一系列标准操作。
state
object optional
描述此节点的
automation.StateType
。subscript
boolean
表示节点文本是下标。
superscript
boolean
表示节点文本是上标。
tableCellAriaColumnIndex
number optional
页面作者指定的 ARIA 列索引。
tableCellAriaRowIndex
number optional
页面作者指定的 ARIA 行索引。
tableCellColumnHeaders
AutomationNode[] optional
表格单元格的列标题节点。
tableCellColumnIndex
number optional
DOM 中指定的单元格所在列的从零开始的索引。
tableCellColumnSpan
number optional
此单元格跨越的列数(默认为 1)。
tableCellRowHeaders
AutomationNode[] optional
表格单元格的行标题节点。
tableCellRowIndex
number optional
DOM 中指定的单元格所在行的从零开始的索引。
tableCellRowSpan
number optional
此单元格跨越的行数(默认为 1)。
tableColumnCount
number optional
DOM 中指定的此表中的列数。
tableColumnHeader
AutomationNode optional
此单元格的相应列标题。
tableColumnIndex
number optional
此列节点的列索引。
tableRowCount
number optional
DOM 中指定的此表中的行数。
tableRowHeader
AutomationNode optional
此单元格的相应行标题。
tableRowIndex
number optional
此行节点的行索引。
textSelEnd
number optional
此可编辑文本元素中所选内容结尾的字符索引; -1 如果没有选择。
textSelStart
number optional
此可编辑文本元素中选择开始的字符索引; -1 如果没有选择。
tooltip
string optional
节点的工具提示(如果有)。
unclippedLocation
Rect optional
此节点在全局屏幕坐标中的位置(作为边界框),不应用任何来自祖先的剪辑。
underline
boolean
表示节点文本是下划线。
url
string optional
此链接将导航到的 URL。
value
string optional
此节点的值:例如
<input> element
的value
属性。valueForRange
number optional
此范围的当前值。
wordEnds
number[] optional
wordStarts
number[] optional
内联文本框中每个单词的开始和结束索引。
addEventListener
function
为给定的事件类型和事件阶段添加一个侦听器。
The
addEventListener
function looks like:(eventType: EventType, listener: function, capture: boolean) => {...}
eventType
listener
function
The
listener
parameter looks like:(event: AutomationEvent) => void
event
capture
boolean
boundsForRange
function
确定文本在由
startIndex
和endIndex
指定的节点内的位置,包括两者。在屏幕坐标中使用边界矩形调用callback
。callback
可以同步或异步调用。边界被剪裁到ancestors(祖先)。The
boundsForRange
function looks like:(startIndex: number, endIndex: number, callback: function) => {...}
createPosition
function
创建一个由 Chrome 的无障碍位置支持支持的位置对象。
The
createPosition
function looks like:(offset: number, isUpstream?: boolean) => {...}
offset
number
isUpstream
boolean optional
returns
doDefault
function
根据此节点的角色执行默认操作。这通常与单击节点所产生的操作相同,例如展开树项、切换复选框、选择单选按钮或激活按钮。
The
doDefault
function looks like:() => {...}
- domQuerySelector
function
获取此节点的子树中与给定 CSS 选择器匹配且位于同一 DOM 上下文中的第一个节点。
如果此节点不与 DOM 中的 HTML 节点直接对应,则 querySelector 将在此节点最近的 HTML 节点祖先上运行。请注意,这可能会导致查询返回一个节点,该节点不是该节点的后代。
如果选择器匹配的节点不直接对应于自动化节点(例如 ARIA 小部件中的元素,其中 ARIA 小部件构成自动化树的一个节点,或通过使用 CSS 或使用 aria-hidden 将其隐藏而无法访问的元素),这将返回与自动化节点相对应的最近ancestor(祖先)。
The
domQuerySelector
function looks like:(selector: string, callback: function) => {...}
selector
string
callback
function
The
callback
parameter looks like:(node: AutomationNode) => void
node
find
function
在此节点的子树中查找与给定搜索参数匹配的第一个 AutomationNode。
The
find
function looks like:(params: FindParams) => {...}
params
returns
findAll
function
在此节点的子树中查找与给定搜索参数匹配的所有 AutomationNode。
The
findAll
function looks like:(params: FindParams) => {...}
params
returns
focus
function
将焦点放在此节点上。
The
focus
function looks like:() => {...}
- getImageData
function
请求图像内容的数据 url,可选择调整大小。为原始大小的 maxWidth 和/或 maxHeight 传递零。
The
getImageData
function looks like:(maxWidth: number, maxHeight: number) => {...}
maxWidth
number
maxHeight
number
getNextTextMatch
function
The
getNextTextMatch
function looks like:(searchStr: string, backward: boolean) => {...}
searchStr
string
backward
boolean
returns
hitTest
function
对给定的全局屏幕坐标进行命中测试,并在结果对象上触发 eventToFire。
The
hitTest
function looks like:(x: number, y: number, eventToFire: EventType) => {...}
x
number
y
number
eventToFire
hitTestWithReply
function
执行
automation.AutomationNode.hitTest
,并接收带有结果命中节点的回调。The
hitTestWithReply
function looks like:(x: number, y: number, callback: function) => {...}
x
number
y
number
callback
function
The
callback
parameter looks like:(node: AutomationNode) => void
node
languageAnnotationForStringAttribute
function
为所提供的字符串属性返回检测到的语言作为 LanguageSpan 对象的数组。 LanguageSpan 数组的格式有几个保证:\1. 为空或包含涵盖相关字符串属性值中所有索引的 LanguageSpans。 2.按startIndex递增排序(startIndex较小的先出现)。\3. LanguageSpans 是非重叠的,并且只包含一种语言。
The
languageAnnotationForStringAttribute
function looks like:(attribute: string) => {...}
attribute
string
returns
makeVisible
function
滚动此节点以使其可见。
The
makeVisible
function looks like:() => {...}
- matches
function
返回此节点是否与给定的
automation.FindParams
匹配。The
matches
function looks like:(params: FindParams) => {...}
params
returns
boolean
performCustomAction
function
执行自定义操作。
The
performCustomAction
function looks like:(customActionId: number) => {...}
customActionId
number
performStandardAction
function
执行此节点支持的标准操作的便捷方法。对于需要额外参数的操作,调用特定的绑定,例如
setSelection
。The
performStandardAction
function looks like:(actionType: ActionType) => {...}
actionType
removeEventListener
function
删除给定事件类型和事件阶段的侦听器。
The
removeEventListener
function looks like:(eventType: EventType, listener: function, capture: boolean) => {...}
eventType
listener
function
The
listener
parameter looks like:(event: AutomationEvent) => void
event
capture
boolean
replaceSelectedText
function
替换文本字段中的选定文本。
The
replaceSelectedText
function looks like:(value: string) => {...}
value
string
resumeMedia
function
继续播放此树中的任何媒体。
The
resumeMedia
function looks like:() => {...}
- scrollBackward
function
向后滚动此可滚动容器。
The
scrollBackward
function looks like:(callback?: function) => {...}
callback
function optional
The
callback
parameter looks like:(result: boolean) => void
result
boolean
scrollDown
function
向下滚动此可滚动容器。
The
scrollDown
function looks like:(callback?: function) => {...}
callback
function optional
The
callback
parameter looks like:(result: boolean) => void
result
boolean
scrollForward
function
向前滚动此可滚动容器。
The
scrollForward
function looks like:(callback?: function) => {...}
callback
function optional
The
callback
parameter looks like:(result: boolean) => void
result
boolean
scrollLeft
function
向左滚动此可滚动容器。
The
scrollLeft
function looks like:(callback?: function) => {...}
callback
function optional
The
callback
parameter looks like:(result: boolean) => void
result
boolean
scrollRight
function
向右滚动此可滚动容器。
The
scrollRight
function looks like:(callback?: function) => {...}
callback
function optional
The
callback
parameter looks like:(result: boolean) => void
result
boolean
scrollToPoint
function
将此可滚动容器滚动到给定点。
The
scrollToPoint
function looks like:(x: number, y: number) => {...}
x
number
y
number
scrollUp
function
向上滚动此可滚动容器。
The
scrollUp
function looks like:(callback?: function) => {...}
callback
function optional
The
callback
parameter looks like:(result: boolean) => void
result
boolean
setAccessibilityFocus
function
设置可访问性焦点。可访问性焦点是扩展跟踪用户焦点的节点。这可以通过聚焦环或扩展程序输出的语音来传达。自动化将向可访问性焦点分派更多事件,例如位置更改。
The
setAccessibilityFocus
function looks like:() => {...}
- setScrollOffset
function
设置此可滚动容器的滚动偏移量。
The
setScrollOffset
function looks like:(x: number, y: number) => {...}
x
number
y
number
setSelection
function
在文本字段中设置选择。
The
setSelection
function looks like:(startIndex: number, endIndex: number) => {...}
startIndex
number
endIndex
number
setSequentialFocusNavigationStartingPoint
function
清除焦点并将此节点设置为用户下次按下 Tab 或 Shift+Tab 时的起点。
The
setSequentialFocusNavigationStartingPoint
function looks like:() => {...}
- setValue
function
设置文本字段的值。
The
setValue
function looks like:(value: string) => {...}
value
string
showContextMenu
function
显示此元素的上下文菜单,就像用户右键单击一样。
The
showContextMenu
function looks like:() => {...}
- startDuckingMedia
function
开始回避此树中的任何媒体。
The
startDuckingMedia
function looks like:() => {...}
- stopDuckingMedia
function
停止回避这棵树内的任何媒体。
The
stopDuckingMedia
function looks like:() => {...}
- suspendMedia
function
暂停在此树中播放的任何媒体。
The
suspendMedia
function looks like:() => {...}
- unclippedBoundsForRange
function
确定文本在由
startIndex
和endIndex
指定的节点内的位置,包括两者。在屏幕坐标中使用边界矩形调用callback
。callback
可以同步或异步调用。边界不会剪裁到ancestors(祖先)。The
unclippedBoundsForRange
function looks like:(startIndex: number, endIndex: number, callback: function) => {...}
AutomationPosition
PROPERTIES
affinity
string
childIndex
number
node
AutomationNode optional
textOffset
number
asLeafTextPosition
function
The
asLeafTextPosition
function looks like:() => {...}
- asTextPosition
function
The
asTextPosition
function looks like:() => {...}
- asTreePosition
function
The
asTreePosition
function looks like:() => {...}
- atEndOfAnchor
function
The
atEndOfAnchor
function looks like:() => {...}
returns
boolean
atEndOfDocument
function
The
atEndOfDocument
function looks like:() => {...}
returns
boolean
atEndOfFormat
function
The
atEndOfFormat
function looks like:() => {...}
returns
boolean
atEndOfLine
function
The
atEndOfLine
function looks like:() => {...}
returns
boolean
atEndOfPage
function
The
atEndOfPage
function looks like:() => {...}
returns
boolean
atEndOfParagraph
function
The
atEndOfParagraph
function looks like:() => {...}
returns
boolean
atEndOfWord
function
The
atEndOfWord
function looks like:() => {...}
returns
boolean
atStartOfAnchor
function
The
atStartOfAnchor
function looks like:() => {...}
returns
boolean
atStartOfDocument
function
The
atStartOfDocument
function looks like:() => {...}
returns
boolean
atStartOfFormat
function
The
atStartOfFormat
function looks like:() => {...}
returns
boolean
atStartOfLine
function
The
atStartOfLine
function looks like:() => {...}
returns
boolean
atStartOfPage
function
The
atStartOfPage
function looks like:() => {...}
returns
boolean
atStartOfParagraph
function
The
atStartOfParagraph
function looks like:() => {...}
returns
boolean
atStartOfWord
function
The
atStartOfWord
function looks like:() => {...}
returns
boolean
getText
function
The
getText
function looks like:() => {...}
returns
string
isInLineBreak
function
The
isInLineBreak
function looks like:() => {...}
returns
boolean
isInTextObject
function
The
isInTextObject
function looks like:() => {...}
returns
boolean
isInWhiteSpace
function
The
isInWhiteSpace
function looks like:() => {...}
returns
boolean
isLeafTextPosition
function
The
isLeafTextPosition
function looks like:() => {...}
returns
boolean
isNullPosition
function
The
isNullPosition
function looks like:() => {...}
returns
boolean
isTextPosition
function
The
isTextPosition
function looks like:() => {...}
returns
boolean
isTreePosition
function
The
isTreePosition
function looks like:() => {...}
returns
boolean
isValid
function
The
isValid
function looks like:() => {...}
returns
boolean
maxTextOffset
function
The
maxTextOffset
function looks like:() => {...}
returns
number
moveToNextAnchorPosition
function
The
moveToNextAnchorPosition
function looks like:() => {...}
- moveToNextCharacterPosition
function
The
moveToNextCharacterPosition
function looks like:() => {...}
- moveToNextFormatEndPosition
function
The
moveToNextFormatEndPosition
function looks like:() => {...}
- moveToNextFormatStartPosition
function
The
moveToNextFormatStartPosition
function looks like:() => {...}
- moveToNextLeafTextPosition
function
The
moveToNextLeafTextPosition
function looks like:() => {...}
- moveToNextLeafTreePosition
function
The
moveToNextLeafTreePosition
function looks like:() => {...}
- moveToNextLineEndPosition
function
The
moveToNextLineEndPosition
function looks like:() => {...}
- moveToNextLineStartPosition
function
The
moveToNextLineStartPosition
function looks like:() => {...}
- moveToNextPageEndPosition
function
The
moveToNextPageEndPosition
function looks like:() => {...}
- moveToNextPageStartPosition
function
The
moveToNextPageStartPosition
function looks like:() => {...}
- moveToNextParagraphEndPosition
function
The
moveToNextParagraphEndPosition
function looks like:() => {...}
- moveToNextParagraphStartPosition
function
The
moveToNextParagraphStartPosition
function looks like:() => {...}
- moveToNextWordEndPosition
function
The
moveToNextWordEndPosition
function looks like:() => {...}
- moveToNextWordStartPosition
function
The
moveToNextWordStartPosition
function looks like:() => {...}
- moveToParentPosition
function
The
moveToParentPosition
function looks like:() => {...}
- moveToPositionAtEndOfAnchor
function
The
moveToPositionAtEndOfAnchor
function looks like:() => {...}
- moveToPositionAtEndOfDocument
function
The
moveToPositionAtEndOfDocument
function looks like:() => {...}
- moveToPositionAtStartOfAnchor
function
The
moveToPositionAtStartOfAnchor
function looks like:() => {...}
- moveToPositionAtStartOfDocument
function
The
moveToPositionAtStartOfDocument
function looks like:() => {...}
- moveToPreviousAnchorPosition
function
The
moveToPreviousAnchorPosition
function looks like:() => {...}
- moveToPreviousCharacterPosition
function
The
moveToPreviousCharacterPosition
function looks like:() => {...}
- moveToPreviousFormatEndPosition
function
The
moveToPreviousFormatEndPosition
function looks like:() => {...}
- moveToPreviousFormatStartPosition
function
The
moveToPreviousFormatStartPosition
function looks like:() => {...}
- moveToPreviousLeafTextPosition
function
The
moveToPreviousLeafTextPosition
function looks like:() => {...}
- moveToPreviousLeafTreePosition
function
The
moveToPreviousLeafTreePosition
function looks like:() => {...}
- moveToPreviousLineEndPosition
function
The
moveToPreviousLineEndPosition
function looks like:() => {...}
- moveToPreviousLineStartPosition
function
The
moveToPreviousLineStartPosition
function looks like:() => {...}
- moveToPreviousPageEndPosition
function
The
moveToPreviousPageEndPosition
function looks like:() => {...}
- moveToPreviousPageStartPosition
function
The
moveToPreviousPageStartPosition
function looks like:() => {...}
- moveToPreviousParagraphEndPosition
function
The
moveToPreviousParagraphEndPosition
function looks like:() => {...}
- moveToPreviousParagraphStartPosition
function
The
moveToPreviousParagraphStartPosition
function looks like:() => {...}
- moveToPreviousWordEndPosition
function
The
moveToPreviousWordEndPosition
function looks like:() => {...}
- moveToPreviousWordStartPosition
function
The
moveToPreviousWordStartPosition
function looks like:() => {...}
CustomAction
PROPERTIES
description
string
id
number
DefaultActionVerb
描述执行默认操作时可能的操作。
TYPE
"activate", "check", "click", "clickAncestor", "jump", "open", "press", "select", or "uncheck"
DescriptionFromType
TYPE
"ariaDescription", "buttonLabel", "relatedElement", "rubyAnnotation", "summary", "svgDescElement", "tableCaption", or "title"
EventType
在automation.AutomationNode
上触发的可能事件。
TYPE
"accessKeyChanged", "activeDescendantChanged", "alert", "ariaAttributeChanged", "ariaCurrentChanged", "atomicChanged", "autoCompleteChanged", "autocorrectionOccured", "blur", "busyChanged", "caretBoundsChanged", "checkedStateChanged", "checkedStateDescriptionChanged", "childrenChanged", "classNameChanged", "clicked", "collapsed", "controlsChanged", "detailsChanged", "describedByChanged", "descriptionChanged", "documentSelectionChanged", "documentTitleChanged", "dropeffectChanged", "editableTextChanged", "enabledChanged", "endOfTest", "expanded", "expandedChanged", "flowFromChanged", "flowToChanged", "focus", "focusAfterMenuClose", "focusChanged", "focusContext", "grabbedChanged", "haspopupChanged", "hide", "hierarchicalLevelChanged", "hitTestResult", "hover", "ignoredChanged", "imageAnnotationChanged", "imageFrameUpdated", "invalidStatusChanged", "keyShortcutsChanged", "labeledByChanged", "languageChanged", "layoutComplete", "layoutInvalidated", "liveRegionChanged", "liveRegionCreated", "liveRegionNodeChanged", "liveRelevantChanged", "liveStatusChanged", "loadComplete", "loadStart", "locationChanged", "mediaStartedPlaying", "mediaStoppedPlaying", "menuEnd", "menuItemSelected", "menuListItemSelected", "menuListValueChanged", "menuPopupEnd", "menuPopupStart", "menuStart", "mouseCanceled", "mouseDragged", "mouseMoved", "mousePressed", "mouseReleased", "multilineStateChanged", "multiselectableStateChanged", "nameChanged", "objectAttributeChanged", "otherAttributeChanged", "parentChanged", "placeholderChanged", "portalActivated", "positionInSetChanged", "rangeValueChanged", "rangeValueMaxChanged", "rangeValueMinChanged", "rangeValueStepChanged", "readonlyChanged", "relatedNodeChanged", "requiredStateChanged", "roleChanged", "rowCollapsed", "rowCountChanged", "rowExpanded", "scrollHorizontalPositionChanged", "scrollPositionChanged", "scrollVerticalPositionChanged", "scrolledToAnchor", "selectedChanged", "selectedChildrenChanged", "selectedValueChanged", "selection", "selectionAdd", "selectionInTextFieldChanged", "selectionRemove", "setSizeChanged", "show", "sortChanged", "stateChanged", "subtreeCreated", "textAttributeChanged", "textSelectionChanged", "textChanged", "tooltipClosed", "tooltipOpened", "treeChanged", "valueInTextFieldChanged", "valueChanged", "windowActivated", "windowDeactivated", or "windowVisibilityChanged"
FindParams
PROPERTIES
attributes
object optional
属性名称到预期值的映射,例如
{ name: 'Root directory', checkbox_mixed: true }
。字符串属性值可以指定为正则表达式,例如{ name: /stralia$/ }
。除非指定正则表达式,否则预期值必须与实际值的类型和值完全匹配。因此,期望值的类型必须是以下之一:- string
- integer
- float
- boolean
role
RoleType optional
state
object optional
Automation.StateType
到boolean
的映射,指示每个状态是否应该设置。例如:{ StateType.disabled: false }
仅当StateType.disabled
不存在于节点的state
对象中时才匹配。
HasPopup
交互式弹出元素的可用性和类型。
TYPE
"false", "true", "menu", "listbox", "tree", "grid", or "dialog"
IntentCommandType
与automation.AutomationIntent
关联的命令。
TYPE
"clearSelection", "delete", "dictate", "extendSelection", "format", "history", "insert", "marker", "moveSelection", or "setSelection"
IntentInputEventType
与automation.AutomationIntent
关联的输入事件的类型。它描述了一个编辑命令,例如IntentCommandType.insert,更详细。
TYPE
"insertText", "insertLineBreak", "insertParagraph", "insertOrderedList", "insertUnorderedList", "insertHorizontalRule", "insertFromPaste", "insertFromDrop", "insertFromYank", "insertTranspose", "insertReplacementText", "insertCompositionText", "deleteWordBackward", "deleteWordForward", "deleteSoftLineBackward", "deleteSoftLineForward", "deleteHardLineBackward", "deleteHardLineForward", "deleteContentBackward", "deleteContentForward", "deleteByCut", "deleteByDrag", "historyUndo", "historyRedo", "formatBold", "formatItalic", "formatUnderline", "formatStrikeThrough", "formatSuperscript", "formatSubscript", "formatJustifyCenter", "formatJustifyFull", "formatJustifyRight", "formatJustifyLeft", "formatIndent", "formatOutdent", "formatRemove", or "formatSetBlockTextDirection"
IntentMoveDirectionType
与automation.AutomationIntent
关联的移动方向。
TYPE
"backward", or "forward"
IntentTextBoundaryType
与automation.AutomationIntent
关联的文本边界。
TYPE
"character", "formatEnd", "formatStart", "formatStartOrEnd", "lineEnd", "lineStart", "lineStartOrEnd", "object", "pageEnd", "pageStart", "pageStartOrEnd", "paragraphEnd", "paragraphStart", "paragraphStartSkippingEmptyParagraphs", "paragraphStartOrEnd", "sentenceEnd", "sentenceStart", "sentenceStartOrEnd", "webPage", "wordEnd", "wordStart", or "wordStartOrEnd"
InvalidState
列出 invalidState
可以采用的值。
TYPE
"false", or "true"
LanguageSpan
PROPERTIES
endIndex
number
包含语言的子字符串的唯一结束索引。
language
string
检测到的子字符串语言。
probability
number
语言正确的概率。
startIndex
number
包含语言的子字符串的包含起始索引。
Marker
PROPERTIES
endOffset
number
关联节点文本内的结束偏移量。
flags
object
MarkerType 到 true 或 undefined 的映射,指示此标记的标记类型。
startOffset
number
关联节点文本内的起始偏移量。
MarkerType
文本上的标记类型。请参阅 AutomationNode.markerTypes
。
TYPE
"spelling", "grammar", "textMatch", "activeSuggestion", "suggestion", or "highlight"
NameFromType
节点名称的来源。
TYPE
"uninitialized", "attribute", "attributeExplicitlyEmpty", "caption", "contents", "placeholder", "relatedElement", "title", or "value"
Rect
PROPERTIES
height
number
left
number
top
number
width
number
Restriction
对象的输入限制——甚至可以禁用非控件。
TYPE
"disabled", or "readOnly"
RoleType
描述了一个automation.AutomationNode
的目的。
TYPE
"abbr", "alert", "alertDialog", "application", "article", "audio", "banner", "blockquote", "button", "canvas", "caption", "caret", "cell", "checkBox", "client", "code", "colorWell", "column", "columnHeader", "comboBoxGrouping", "comboBoxMenuButton", "comment", "complementary", "contentDeletion", "contentInsertion", "contentInfo", "date", "dateTime", "definition", "descriptionList", "descriptionListDetail", "descriptionListTerm", "desktop", "details", "dialog", "directory", "disclosureTriangle", "docAbstract", "docAcknowledgments", "docAfterword", "docAppendix", "docBackLink", "docBiblioEntry", "docBibliography", "docBiblioRef", "docChapter", "docColophon", "docConclusion", "docCover", "docCredit", "docCredits", "docDedication", "docEndnote", "docEndnotes", "docEpigraph", "docEpilogue", "docErrata", "docExample", "docFootnote", "docForeword", "docGlossary", "docGlossRef", "docIndex", "docIntroduction", "docNoteRef", "docNotice", "docPageBreak", "docPageFooter", "docPageHeader", "docPageList", "docPart", "docPreface", "docPrologue", "docPullquote", "docQna", "docSubtitle", "docTip", "docToc", "document", "embeddedObject", "emphasis", "feed", "figcaption", "figure", "footer", "footerAsNonLandmark", "form", "genericContainer", "graphicsDocument", "graphicsObject", "graphicsSymbol", "grid", "group", "header", "headerAsNonLandmark", "heading", "iframe", "iframePresentational", "image", "imeCandidate", "inlineTextBox", "inputTime", "keyboard", "labelText", "layoutTable", "layoutTableCell", "layoutTableRow", "legend", "lineBreak", "link", "list", "listBox", "listBoxOption", "listGrid", "listItem", "listMarker", "log", "main", "mark", "marquee", "math", "mathMLFraction", "mathMLIdentifier", "mathMLMath", "mathMLMultiscripts", "mathMLNoneScript", "mathMLNumber", "mathMLOperator", "mathMLOver", "mathMLPrescriptDelimiter", "mathMLRoot", "mathMLRow", "mathMLSquareRoot", "mathMLStringLiteral", "mathMLSub", "mathMLSubSup", "mathMLSup", "mathMLTable", "mathMLTableCell", "mathMLTableRow", "mathMLText", "mathMLUnder", "mathMLUnderOver", "menu", "menuBar", "menuItem", "menuItemCheckBox", "menuItemRadio", "menuListOption", "menuListPopup", "meter", "navigation", "note", "pane", "paragraph", "pdfActionableHighlight", "pdfRoot", "pluginObject", "popUpButton", "portal", "pre", "progressIndicator", "radioButton", "radioGroup", "region", "rootWebArea", "row", "rowGroup", "rowHeader", "ruby", "rubyAnnotation", "scrollBar", "scrollView", "search", "searchBox", "section", "slider", "spinButton", "splitter", "staticText", "status", "strong", "subscript", "suggestion", "superscript", "svgRoot", "switch", "tab", "tabList", "tabPanel", "table", "tableHeaderContainer", "term", "textField", "textFieldWithComboBox", "time", "timer", "titleBar", "toggleButton", "toolbar", "tooltip", "tree", "treeGrid", "treeItem", "unknown", "video", "webView", or "window"
SetDocumentSelectionParams
PROPERTIES
anchorObject
选择开始的节点。
anchorOffset
number
选择开始的锚节点中的偏移量。
focusObject
选择结束的节点。
focusOffset
number
选择结束的焦点节点内的偏移量。
SortDirectionType
应用于表格行或列标题的排序。
TYPE
"unsorted", "ascending", "descending", or "other"
StateType
描述一个automation.AutomationNode
的特征。
TYPE
"autofillAvailable", "collapsed", "default", "editable", "expanded", "focusable", "focused", "horizontal", "hovered", "ignored", "invisible", "linked", "multiline", "multiselectable", "offscreen", "protected", "required", "richlyEditable", "vertical", or "visited"
TreeChange
PROPERTIES
target
type
变化的类型。
TreeChangeObserverFilter
使用 addTreeChangeObserver 侦听可能的树更改。请注意,侦听所有树更改可能会很昂贵。
TYPE
"noTreeChanges", "liveRegionTreeChanges", "textMarkerChanges", or "allTreeChanges"
TreeChangeType
自动化树的可能更改。对于树的任何给定原子更改,添加、删除或更改的每个节点都将出现在一个 TreeChange 中,具有这些类型之一。
nodeCreated 意味着此节点已添加到树中,并且其父节点也是新节点,因此它只是添加了新子树中的一个节点。
TYPE
"nodeCreated", "subtreeCreated", "nodeChanged", "textChanged", "nodeRemoved", or "subtreeUpdateEnd"
Methods
addTreeChangeObserver
chrome.automation.addTreeChangeObserver( filter: TreeChangeObserverFilter, observer: function, )
添加树更改观察器。树变化观察者是静态/全局的,他们监听所有树的变化。传递过滤器以确定要侦听的特定树更改,并注意侦听所有树更改可能会很昂贵。
PARAMETERS
filter
observer
function
The
observer
parameter looks like:(treeChange: TreeChange) => void
treeChange
getAccessibilityFocus
chrome.automation.getAccessibilityFocus(
callback: function,
)
全局获取当前具有可访问性焦点的自动化节点。如果任何加载的树中的节点都没有可访问性焦点,则将返回 null。
PARAMETERS
callback
function
The
callback
parameter looks like:(focusedNode: AutomationNode) => void
focusedNode
getDesktop
chrome.automation.getDesktop(
callback: function,
)
获取整个桌面的自动化树,其中包含所有屏幕视图。请注意,此 API 目前仅在 Chrome 操作系统上受支持。
PARAMETERS
callback
function
The
callback
parameter looks like:(rootNode: AutomationNode) => void
rootNode
getFocus
chrome.automation.getFocus(
callback: function,
)
全局获取当前具有焦点的自动化节点。如果任何加载树中的节点都没有焦点,则返回 null。
PARAMETERS
callback
function
The
callback
parameter looks like:(focusedNode: AutomationNode) => void
focusedNode
getTree
chrome.automation.getTree(
tabId?: number,
callback?: function,
)
获取具有给定 tabId 的选项卡的自动化树,如果未指定 tabID,则获取当前选项卡,必要时启用自动化。返回带有占位符根节点的树;侦听“loadComplete”事件以获取树已完全加载的通知(先前的根节点引用将在此时或之前停止工作)。
PARAMETERS
tabId
number optional
callback
function optional
The
callback
parameter looks like:(rootNode: AutomationNode) => void
rootNode
removeTreeChangeObserver
chrome.automation.removeTreeChangeObserver(
observer: function,
)
删除树更改观察器。
PARAMETERS
observer
function
The
observer
parameter looks like:(treeChange: TreeChange) => void
treeChange
setDocumentSelection
chrome.automation.setDocumentSelection(
params: SetDocumentSelectionParams,
)
在树中设置选择。这会在单个树中创建一个选择(anchorObject 和 focusObject 必须具有相同的根)。树中两个节点/偏移对之间的所有内容都包含在选择中。锚点是用户开始选择的地方,而焦点是选择扩展的点,例如使用鼠标或键盘拖动时。对于角色为 staticText 的节点,偏移量分别给出了选择开始或结束的值内的字符偏移量。
PARAMETERS
By.一粒技术服务.