{click}
Sample Usage
Quick Overview VideoSettings
Setting Name Type Description selector selector CSS selector to click on a specific element in the page. maxdelay time The selected element is clicked as soon as it becomes clickable. If the selected element does not become clickable within 'maxdelay' time, the snippet stops and an error is shown. General Command Settings trim yes/no/left/right If yes
whitespace is removed before and after the command. If left
, only whitespace to the left is removed. If right
, only whitespace to the right is removed.
Setting Name | Type | Description |
---|---|---|
selector | selector | CSS selector to click on a specific element in the page. |
maxdelay | time | The selected element is clicked as soon as it becomes clickable. If the selected element does not become clickable within 'maxdelay' time, the snippet stops and an error is shown. |
General Command Settings | ||
trim | yes/no/left/right | If yes whitespace is removed before and after the command. If left , only whitespace to the left is removed. If right , only whitespace to the right is removed. |
The {click}
command, an autopilot command, allows you to emulate a click on an element on the web page. This can be used to submit a form, focus another textbox or trigger other events in the page. You can use the {click}
command in two approaches:
Click on the currently focused element
You can use the {click}
command in conjunction with the {key} command, another autopilot command, to move the focus to another element in the page and then use the {click}
command to click the element. Click here to learn more about moving the focus back and forth between different elements on a page.
For example: the snippet {key: tab}{key: tab}{key: tab}{click}
will emulate the Tab key three times - changing the focused element on each step - and then emulate a click on the latest focused element.
Click on any element in the page
Use the "Select from website" button in the {click}
command to select an element that you wish to click on. The Text Blaze snippet will click the selected element, which will then also become focused.
We recommend this approach for most users because it's very fast. It is useful to:
- Jump directly to another textbox in the page
Example: running the snippetAlpha{click: selector=selector}Beta
will insert "Alpha" in the first textbox (where you started your snippet), then jump to the second textbox (selected by "selector") and then insert "Beta" in the second textbox - Click on consecutive checkboxes or buttons
Example: When submitting a form, the snippet{click: selector=button1}{click: selector=checkbox1}{click: selector=submit_button}
will click a button, then another checkbox, and then the submit button on the form.
The given snippets are examples. Please use the "Select from website" button in the {click}
command to generate a selector for your specific website.
Text Blaze will wait up to one second for an interactive element that matches the specified selector to appear on the page. If you want to wait longer, you can specify the maxdelay
attribute. For example, the following command {click: selector=selector; maxdelay=5s}
will wait up to five seconds to match the given selector to an element in the page.
To learn more about automating actions on a web page, see the autopilot guide.