MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / click

Function click

javascript/atoms/typescript/click.ts:30–39  ·  view source on GitHub ↗
(element: Element, optCoords?: Coordinate | null)

Source from the content-addressed store, hash-verified

28// bot.action.click also took a mouse to reuse and a flag forcing mouseup onto
29// a non-interactable element. Neither crosses the wire, so they are not kept.
30function click(element: Element, optCoords?: Coordinate | null): void {
31 if (!isShown(element, /* optIgnoreOpacity= */ true)) {
32 throw botError(ELEMENT_NOT_INTERACTABLE, 'Element is not currently visible and may not be manipulated')
33 }
34 scrollIntoView(element, optCoords || undefined)
35 const mouse = new Mouse()
36 mouse.move(element, optCoords || interactableCentre(element))
37 mouse.pressButton()
38 mouse.releaseButton()
39}
40
41// An element with no area of its own (an empty inline wrapper, say) is aimed
42// at through its offsetParent's size, as bot.action.getInteractableSize did.

Callers 4

double_clickMethod · 0.85
context_clickMethod · 0.85
send_keysMethod · 0.85
key_actionMethod · 0.85

Calls 6

moveMethod · 0.95
pressButtonMethod · 0.95
releaseButtonMethod · 0.95
botErrorFunction · 0.85
scrollIntoViewFunction · 0.85
interactableCentreFunction · 0.85

Tested by

no test coverage detected