What is it?
The Browser Bro Shorthand Language is a simple, human-friendly scripting language designed to automate common tasks in a browser, such as clicking buttons, typing into fields or forms, scrolling, navigating, and more. Each instruction is on its own line, and the browser executes these lines in sequence. It is intended to create deterministic workflows on webpages. Its power is designed for automating tedious, laborious, exact, and predetermined tasks in the browser.The Delimiter
Each command line is divided into parts (the command and its parameters) using the pipe character|
. We chose |
because it’s not commonly used in HTML attributes or content, making it easy to visually separate each piece of the command and keep things clear.
command|parameter1|parameter2|...
Browser Array Targeting
You can target specific browsers in the Browser Bro Array by prefixing your command with the number. If no number is specified, the command executes in the Scripting Output Browser.// Execute in browser instance 1
1|Click|ID|submitButton
// Execute in browser instance 2
2|Type|ID|username|John
// Execute in default instance
Click|ID|loginButton
Variables
Variables allow you to store and reuse information throughout your script. They are always referenced using a tilde (~
) before the variable name. For example, ~myVar
refers to a variable named myVar
.
You can set a variable to a fixed value, load its content from a file, or get it from the text editor. Once set, you can reference that variable in commands later in the script.
Example:
// Set a variable to a fixed string:
set|~myVar|Hello World
// Use that variable in a Type command:
Type|ID|usernameField|~myVar
// Set a variable from a file:
set|~myFileVar|file|path/to/file.txt
// Set a variable from text editor:
set|~editorContent|text editor
// Get a value from the page and store in variable:
get|ID|emailField|~userEmail
Referencing Elements in the DOM
In order to do something on a page, we need a way to reference the controls on it. The shorthand language supports four main ways of referencing elements:- ID: By element
id
- name: By
name
attribute - class: By CSS
class
name - aria: By
aria-label
attribute
Format
Each command line follows this pattern:command|param1|param2|...
Remember to use Wait
between actions to avoid performing tasks too rapidly and risking bans or blocks from websites.
Commands Reference
Below is a comprehensive list of all available commands in the Browser Bro Shorthand Language.set
Purpose: Assign a value to a variable, load content from a file into a variable, or set the variable to the content of the Browser Bro text editor
set|~variableName|value
or set|~variableName|file|path/to/file.txt
or set|~variableName|text editor
set|~greeting|Hello there!
set|~config|file|config.txt
set|~prompts|text editor
get
Purpose: Retrieve the value from a DOM element and store it in a variable
get|[reference_type]|[reference_value]|~variableName
get|ID|emailField|~userEmail
get|name|username|~userName
get|class|form-input|~inputValue
get|aria|Search Box|~searchTerm
ask
Purpose: Display a dialog box to prompt the user for input and store the response in a variable
ask|[prompt message]|~variableName
ask|Please enter your username|~username
ask|What is your age?|~userAge
ask|Enter search term|~searchQuery
js
Purpose: Execute raw JavaScript code.
js|[JavaScript code]
js|console.log('Hello world!');
js|document.title = 'New Title';
js|localStorage.setItem('key', 'value');
custom
Purpose: Execute a pre-defined custom JavaScript snippet with parameter substitution. Parameters replace placeholders like <<<BBSH_1>>>, <<<BBSH_2>>> etc.
custom|snippetName|param1|param2|...
custom|fillForm|John Doe|john@email.com|~password
custom|validateField|phoneNumber|~phoneVar
alert
Purpose: Display a browser alert dialog with static text or variable content.
alert|[Message]
or alert|~variableName
alert|This is an alert message!
alert|Process completed successfully
alert|~myVariable
alert|~userMessage
Zoom
Purpose: Adjust the webpage zoom level. (1 = 100%, 0.5 = 50%, etc.)
Zoom|[zoomFactor]
Zoom|0.75
Zoom|1.5
Zoom|1
Go
Purpose: Navigate through browser history, load a new URL with optional parameters, or navigate to the Browser Bro Array.
Go|Array
– Navigate to the Browser Bro Array viewGo|Forward
– Go forward in historyGo|Back
– Go back in historyGo|[URL]
– Navigate to URLGo|[URL]|param|key1|value1|key2|value2
– URL with query parametersGo|[URL]|path|segment1|segment2
– URL with path segments
Go|Array
Go|https://www.example.com
Go|Forward
Go|Back
Go|https://api.example.com|param|apiKey|~myKey|format|json
Go|https://example.com|path|users|~userId|profile
Reload
Purpose: Refresh the current webpage.
Reload
Reload
Wait
Purpose: Pause the script execution for a specified time. Use this to let pages load and avoid hitting servers too quickly.
Wait|[Number]
– Wait for seconds (default)Wait|[Number]|Seconds/Minutes/Hours
Wait|[min,max]|Seconds/Minutes/Hours
– Random wait between min and max
Wait|5
Wait|5|Seconds
Wait|1|Minutes
Wait|3,6|Seconds // Random wait between 3 and 6 seconds
Scroll
Purpose: Scroll the page up or down by pixels, or scroll to a specific element using CSS-style selectors.
Scroll|Down|[pixels]
– Scroll down by pixelsScroll|Up|[pixels]
– Scroll up by pixelsScroll|#elementId
– Scroll to element by IDScroll|.elementClass
– Scroll to element by classScroll|[pixels]
– Default down scrolling
Scroll|Down|500
Scroll|Up|300
Scroll|#header-section
Scroll|.footer-content
Scroll|400 // Default down scrolling
Type
Purpose: Type text into an element identified by
On some pages you may need to add “.innerhtml” to the reference type to set HTML content instead of input values.
ID
, name
, class
, aria
-label. You can also reference variables (e.g., ~myVar
).Selector Type | Syntax |
---|---|
By ID | Type|ID|elementID|textOr~var |
By name | Type|name|elementName|textOr~var |
By class | Type|class|elementClass|textOr~var |
By aria | Type|aria|ariaLabel|textOr~var |
Set innerHTML | Type|ID.innerhtml|elementID|htmlContent |
Type|ID|usernameField|TestUser
Type|name|passwordField|~myVar // Using a variable
Type|aria|Search|Find this text
Type|ID.innerhtml|contentDiv|<h1>Hello World</h1>
Type|aria.innerhtml|Description Box|~htmlContent
Focus
Purpose: Set the focus on an element so it becomes active.
Focus|[reference_type]|[reference_value]
Focus|ID|usernameField
Focus|name|user_password
Focus|class|input-field
Focus|aria|Email Address
Click
Purpose: Simulate a mouse click on an element.
Click|[reference_type]|[reference_value]
Click|ID|submitButton
Click|class|btn-primary
Click|aria|Close
Click|name|loginBtn
Select
Purpose: Choose an option from a dropdown select element.
Select|[reference_type]|[reference_value]|optionValue
Select|ID|countryDropdown|US
Select|name|languageSelector|fr
Select|class|form-select|option2
Select|aria|Choose State|CA
Press
Purpose: Simulate keyboard key presses on a specific element. Supports special keys and single characters.
Press|[reference_type]|[reference_value]|[key]
Supported special keys: Enter, Escape, Space, Tab, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, Backspace, Delete
Press|ID|searchField|Enter
Press|class|text-input|Escape
Press|name|username|a
Press|aria|Message Box|Space
Press|ID|textArea|Backspace
loop
Purpose: Create loops to repeat commands. Must be closed with
loop|end
.loop|[number]
– Loop a specific number of timesloop|each line|~sourceVar|~currentLineVar
– Loop through linesloop|each item|~sourceVar|~currentItemVar
– Loop through itemsloop|end
– End the loop
// Loop 5 times
loop|5
Click|ID|likeButton
Wait|1|Seconds
loop|end
// Loop through each line
set|~names|file|names.txt
loop|each line|~names|~currentName
Type|ID|nameField|~currentName
Click|ID|submitBtn
Wait|2|Seconds
loop|end
// Loop through items
loop|each item|~itemList|~currentItem
js|console.log('Processing item: ~currentItem');
loop|end
shell
Purpose: Run a local shell command (synchronous execution)
shell|[command]
shell|ls -la
shell|mkdir new_folder
shell|echo "Hello World"
asyncShell
Purpose: Run a local shell command asynchronously (non-blocking)
asyncShell|[command]
asyncShell|npm install
asyncShell|python long_running_script.py
Breakpoint
Purpose: Insert a debugging breakpoint to pause script execution for debugging
Breakpoint
Type|ID|username|testuser
Breakpoint
Click|ID|submit
Snapshot
Purpose: Take a screenshot of the current browser view (Note: Not yet implemented)
Snapshot
Note: It is important to test which method of saving the page works best. In the Browser Array, you can use the ‘Test Screenshots’ method in the 3 dots menu of the browser # you want to test.
Tips and Best Practices
✓ DO:
- Always use
Wait
commands between actions to avoid overwhelming servers - Use random wait times (e.g.,
Wait|3,6|Seconds
) to appear more human-like - Store sensitive data in variables rather than hardcoding them
- Add comments to document your scripts
- Test your scripts on a small scale before running large batches
- Use the
get
command to verify actions completed successfully
✗ DON’T:
- Don’t run scripts too quickly without appropriate delays
- Don’t ignore rate limits or terms of service
- Don’t hardcode passwords or sensitive information
- Don’t forget to handle errors and edge cases
- Don’t run untested scripts on production websites
Troubleshooting
Common Issues and Solutions
Issue | Solution |
---|---|
Element not found | Add a longer Wait before the action, verify the selector is correct |
Script runs too fast | Add more Wait commands between actions |
Variable not working | Ensure variable starts with ~ and is set before use |
Loop not ending | Make sure every loop has a matching loop|end |
Type command not working | Try adding .innerhtml to the reference type |
Comments
If you need to add notes or temporarily disable certain instructions, start a line with//
.