Convenience APIs
The following APIs are shortcuts for equivalent calls to the underlying
pointer()
and keyboard()
APIs.
Clicks
click()
click(element: Element): Promise<void>
pointer([{target: element}, {keys: '[MouseLeft]', target: element}])
The first action might be skipped per skipHover
.
dblClick()
dblClick(element: Element): Promise<void>
pointer([{target: element}, {keys: '[MouseLeft][MouseLeft]', target: element}])
tripleClick()
tripleClick(element: Element): Promise<void>
pointer([
{target: element},
{keys: '[MouseLeft][MouseLeft][MouseLeft]', target: element},
])
Mouse movement
hover()
hover(element: Element): Promise<void>
pointer({target: element})
unhover()
unhover(element: Element): Promise<void>
pointer({target: element.ownerDocument.body})
Keyboard
tab()
tab(options: {shift?: boolean}): Promise<void>
// without shift
keyboard('{Tab}')
// with shift=true
keyboard('{Shift>}{Tab}{/Shift}')
// with shift=false
keyboard('[/ShiftLeft][/ShiftRight]{Tab}')