Waiting

Wait for a fixed amount of time

To wait for a fixed amount of time, use the wait instruction with the duration, in ms, you want to wait for.

If you want to wait for 2 seconds, you need to use this JavaScript scenario:

JSON
1
{
2
"instructions": [
3
{"wait": 2000}
4
]
5
}

Wait for an element to appear

To wait for a particular element to appear, use the wait_for instruction with the CSS/XPath selector of the element you want to wait for.

If you want to wait for the element whose class is slow_div to appear before getting some results, you need to use this JavaScript scenario:

JSON
1
{
2
"instructions": [
3
{"wait_for": ".slow_div"}
4
]
5
}

Wait for an element to appear and click

To wait for a particular CSS/XPath element to appear, and then click on it, use the wait_for_and_click instruction.

If you want to wait for the element whose class is slow_div to appear before clicking on it, you need to use this JavaScript scenario:

JSON
1
{
2
"instructions": [
3
{"wait_for_and_click": ".slow_div"}
4
]
5
}

Note: this is exactly the same as using:

JSON
1
{
2
"instructions": [
3
{"wait_for": ".slow_div"},
4
{"click": ".slow_div"}
5
]
6
}