Skip to main content

if

Triggers a nested branch of work when a given condition is true. Does not wait for these items and is a point-in-time check. Use the wait method if you're wanting to await certain behaviors to be present

Example:

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

# Will only trigger the screenshot if the h1 is present
if(selector: "h1") {
screenshot {
base64
}
}
}
if(
request: RequestInput
response: ResponseInput
selector: String
visible: Boolean = false
): Mutation

Arguments

if.request ● RequestInput input

Triggers the nested conditions if a request has been made with the following conditions

if.response ● ResponseInput input

Triggers the nested conditions if a response has been received with the following conditions

if.selector ● String scalar

Triggers the subsequent conditions if the selector is immediately present

if.visible ● Boolean scalar

When using selectors in conditionals this options sets whether their or not to consider if they're visible to the viewport

Type

Mutation object

Below is a list of all available API options for the service. Click on an API for options, examples, and even argument details.

For more comprehensive examples and recipes, see our documentation site here.