# Actions
# chance
Takes a number between 0 and 100 as a percentage of chance to continue other actions. If positive, the execution of next actions will continue. If negative, next actions will not be executed.
# Arguments
Name | Type | Required |
---|---|---|
Chance percentage | int | yes |
// There's a 80% chance that the following actions will be executed
chance(80)
# clickBySelector
Will execute a click on a css selector
location. Equivalent to document.querySelector in javascript. There are 2 ways you can choose to execute the click.
# Arguments
Name | Type | Required |
---|---|---|
Element | string | yes |
Click type | string | optional |
# 'mouse' click (Default)
Using the mouse
option will do the following:
- check if the element exists
- if it does not exist, execution of actions is stopped
- if it exists, will check if the element is visible (and will scroll automatically if needed)
- type of click executed: mouse command sent to the browser
// Will execute a click on the 'myLink' element
clickBySelector("#myLink", "mouse")
# 'js' click
Using the js
option will do the following:
- Will execute a click via Javascript:
document.querySelector("myLink").click();
- If it doesn't exists, other actions will continue
// Will execute a click on the 'myLink' element
clickBySelector("#myLink", "js")
# clickAnyLink
Will execute a click on a link.
- type of click executed: javascript (
item.click();
) - Will click only links that are not anchors.
This command can either have:
- no argument: will click on a random link, other actions will continue if no links are found.
// Click on a random link of the current website
clickAnyLink()
- 2 arguments: will click on links that match specific patterns, can decide if allowed to click on another link if no matching link is found.
// Click on one 'domain1.com' link on the current page. If there is no 'domain1.com' link on the page, it will not click on another link
clickAnyLink(false, ["domain1.com"])
// Click on one 'domain1.com' link on the current page. If there is no 'domain1.com' link on the page, it will choose another random external link to click on
clickAnyLink(true, ["domain1.com"])
Name | Type | Required |
---|---|---|
Click on another link if not found from list | bool | required |
List of links' substrings | string[] | required |
- Click on another link if not found from list: If no link in the list is found and the option is set to
true
, another random link will be clicked. Iffalse
, there will be no click. - List of links' substrings: Array of substrings to choose a link into the page. It's recommended to use partial URLs (without the domain).
# clickExternalLink
Will execute a click on an external link.
- type of click executed: javascript (
item.click();
) - Will click on links that are not from the same domain as the current website
This command can either have:
- no argument: will click on a random external link, other actions will continue if no links are found.
// Click on a random external link of the current website
clickExternalLink()
- 2 arguments: will click on links that match specific patterns, can decide if allowed to click on another external link if no matching link is found.
// Click on one 'domain1.com' link on the current page. If there is no 'domain1.com' link on the page, it will not click on another link
clickExternalLink(false, ["domain1.com"])
// Click on one 'domain1.com' link on the current page. If there is no 'domain1.com' link on the page, it will choose another random external link to click on
clickExternalLink(true, ["domain1.com"])
Name | Type | Required |
---|---|---|
Click on another external link if not found from list | bool | required |
List of links' substrings | string[] | required |
- Click on another external link if not found from list: If no link in the list is found and the option is set to
true
, another random link will be clicked. Iffalse
, there will be no click. - List of links' substrings: Array of substrings to choose a link into the page. It's recommended to use partial URLs (without the domain).
# clickInternalLink
Will execute a click on an internal link. Close to the behavior of the existing "Clicks" feature.
- type of click executed: javascript (
item.click();
) - Will not click on links that are not from the same domain as the current website
This command can either have:
- no argument: will click on a random internal link, other actions will continue if no links are found.
// Click on a random internal link of the current website
clickInternalLink()
- 2 arguments: will click on links that match specific patterns, can decide if allowed to click on another internal link if no matching link is found.
// Click on either /page/1 or /page/2 links on the current page.
// If there is no /page/1 or /page/2 link on the page, it will not click on another link
clickInternalLink(false, ["/page/1", "/page/2"])
// Click on either /page/1 or /page/2 links on the current page.
// If there is no /page/1 or /page/2 link on the page, it will choose another random link to click on
clickInternalLink(true, ["/page/1", "/page/2"])
Name | Type | Required |
---|---|---|
Click on another internal link if not found from list | bool | required |
List of links' substrings | string[] | required |
- Click on another internal link if not found from list: If no link in the list is found and the option is set to
true
, another random link will be clicked. Iffalse
, there will be no click. - List of links' substrings: Array of substrings to choose a link into the page. It's recommended to use partial URLs (without the domain)
# reload
Reload the current page immediately.
// Reload the page
reload()
# setStartUrl (Local testing only)
Set the URL to load first when testing actions locally, likely equals to the URL you entered on Otohits.
// Load google.com
setStartUrl("https://www.google.com")
# wait
Wait for a certain amount of time (seconds).
# Arguments
Name | Type | Required |
---|---|---|
Minimum time | int | yes |
Maximum time | int | optional |
// Wait for 10 seconds
wait(10)
// Wait between 10 and 20 seconds
wait(10,20)
# waitPageLoaded
Wait for the current page to be loaded.
// Wait for the page to be loaded
waitPageLoaded()
← Summary Local testing →