Skip to main content

click

Waits for the element to be visible, scrolls to it, then clicks on it with native events

Example:

mutation ClickButton {
goto(url: "https://example.com") {
status
}

click(selector: "a") {
time
}
}
click(
selector: String!
scroll: Boolean = true
timeout: Float
visible: Boolean = false
wait: Boolean = true
): ClickResponse

Arguments

click.selector ● String! non-null scalar

A query-selector compatible string, JavaScript that returns an HTML Node, OR a Browserless-deep query. Examples include:

  • A simple <button /> Element: selector: "button"

  • A JavaScript snippet that returns a button element selector: "document.querySelector('button')"

  • A Browserless Deep query. These queries must start with a "<" character. Deep queries will traverse all iframes, shadow-doms (open or closed), and more. selector: "< button"

Here's a deep query that filters by iframes with a url of "example.com" and a button with a class of active selector: "< https://example.com/* button.active"

click.scroll ● Boolean scalar

Whether or not to scroll to the element prior to clicking, defaults to true

click.timeout ● Float scalar

How long to wait for the element to appear before timing out on the click handler, overriding any defaults. Default timeout is 30 seconds, or 30000.

click.visible ● Boolean scalar

Whether or not to click the element only if it's visible

click.wait ● Boolean scalar

Whether or not to wait for the element to present in the DOM

Type

ClickResponse object

Response returned after having clicked on an element