Click

Provides functionality to perform click actions on elements in a web page using various selectors. Tries the Selenium Actions API first to generate real OS-level mouse events; if the element is not interactable (commonly because the page hides content before clicking — a recommended pattern for visual-metric scripts), falls back to a JavaScript click so the script keeps working.

Classes

Click

Methods

(async) run(selector, optionsopt) → {Promise.<void>}

Clicks on an element using a unified selector string. Supports CSS selectors (default), and prefix-based strategies: 'id:myId', 'xpath://button', 'text:Submit', 'link:Click here', 'name:email', 'class:btn'.
Parameters:
NameTypeAttributesDescription
selectorstringThe selector string. CSS by default, or use a prefix like 'id:', 'xpath:', 'text:', 'link:', 'name:', 'class:'.
optionsObject<optional>
Options for the click action.
Properties
NameTypeAttributesDefaultDescription
waitForNavigationboolean<optional>
falseIf true, waits for the page complete check after clicking.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the click action is performed.
Type: 
Promise.<void>