List of instructions
General arguments
All the instructions defined below have a consistent set of arguments. The arguments are as follows.
type
typeType:
Enum["click", "input", "scroll", "scroll_to_bottom", "wait", "wait_for_element", "fetch_resource"]Description: Browser instruction type.
timeout_s
timeout_sType:
intDescription: How long until action is skipped if not completed in time.
Restrictions: 0 <
timeout_s<= 60Default value: 5
wait_time_s
wait_time_sType:
intDescription: How long to wait before executing next action.
Restrictions: 0 <
wait_time_s<= 60Default value: 0
on_error
on_errorType:
Enum["error", "skip"]Description: Indicator what to do with instructions in case this instruction fails:
"error": Stops the execution of browser instructions."skip": Continues with the next instruction.
Default value:
"error"
Example with general arguments
{\"type\": \"wait_for_element\", \"selector\": {\"type\": \"text\", \"value\": \"Load More Items\"},\"timeout_s\": 5, \"wait_time_s\": 2, \"on_error\": \"skip\"}Instructions
click
clickDescription: Clicks an element and wait a set count of seconds.
Args:
type: str = "click"selector: dicttype: Enum["xpath", "css", "text"]value: str
Example:
{\"type\": \"click\",\"selector\": {\"type\": \"xpath\",\"value\": \"\/\/button\"}}input
inputDescription: Enters a text into a selected element.
Args:
type: str = "input"selector: dicttype: Enum["xpath", "css", "text"]value: str
value: strExample:
{\"type\": \"input\",\"selector\": {\"type\": \"xpath\",\"value\": \"\/\/input\"},\"value\": \"pizza boxes\"}scroll
scrollDescription: Scrolls a set count of pixels.
Args:
type: str = "scroll"x: inty: int
Example:
{\"type\": \"scroll\",\"x\": 0,\"y\": 100}scroll_to_bottom
scroll_to_bottomDescription: Scrolls to bottom for a set count of seconds.
Args:
type: str = "scroll_to_bottom"
Example:
{\"type\": \"scroll_to_bottom\",\"timeout_s\": 10}wait
waitDescription: Waits a set count of seconds.
Args:
type: str = "wait"
Example:
{\"type\": \"wait\",\"wait_time_s\": 2}wait_for_element
wait_for_elementDescription: Waits for element to load for a set count of seconds.
Args:
type: str = "wait_for_element"selector: dicttype: Enum["xpath", "css", "text"]value: str
Example:
{\"type\": \"wait_for_element\",\"selector\": {\"type\": \"text\",\"value\": \"Load More Items\"},\"timeout_s\": 5}fetch_resource
fetch_resourceThe fetch_resource instruction must be the final instruction in the browser instructions list; any subsequent instructions will not be executed.
Description: Fetches the first occurrence of a Fetch/XHR resource matching the set pattern.
Args:
type: str = "fetch_resource"filter: str(RegEx expression)on_error: Enum["error", "skip"]
Example:
{\"type\": \"fetch_resource\",\"filter\": \"\/graphql\/item\/\"}Instructions' validation
Any inconsistency in regards to instruction format will result in a 400 status code and a corresponding error message.
For example, payload as such:
[{\"type\": \"unsupported-wait\",\"wait_time_s\": 5}]}]Will result in:
{
"errors": {
"message": "Unsupported action type `unsupported-wait`, choose from 'click,fetch_resource,input,scroll,scroll_to_bottom,wait,wait_for_element'"
}
}Last updated
Was this helpful?

