Custom JavaScript library scripts
Leverage our JavaScript library to design custom actions in Low Code Automation. You can also add your custom scripts to this library.
Testers are eager to make the most of custom actions to improve their workflows. We understand that some users may need help to create custom scripts to interact with web pages. Low Code Automation offers a JavaScript library for specific use cases. These resources help users get started quickly and make the most of our custom actions feature. It ensures a smoother, and more efficient experience. Additionally, you can also pass a selected element from the webpage directly to a custom action step.
Use the JavaScript library in custom actions
- In the recorder panel, click the ︙ icon and select Custom Actions (JavaScript).
- Choose the action type and click Use library scripts.
- In the Select library scripts window, choose the desired script from the list. For example, Scroll by pixel, Paste from clipboard, and others. Hovering over the icon next to certain scripts displays the type of custom action they are best suited for.
The script will be added to the code window. The code is written within a function, and the script will be inserted at the cursor’s current position.
In this example, the code is written within thescrollByPixels
function. This way you can use the function multiple times in the code. If required, you can modify the parameters. - Click Execute Script.
Create your own JavaScript
You can create a custom script and add it to the library.
- In the code block, write your custom JavaScript code and click Execute Script.
- After the script executes successfully, click Add to library.
- In the Add new script window, provide a name and description for your script, then click Save snippet.
When naming custom scripts, use action-based names that reflect the script’s function and provide a description that highlights its use case and parameters, helping other users quickly understand its purpose.
Any modifications made to the script after it is imported does not reflect in other tests that are using it.
Delete a script
- Click Use library script.
- In the Select library scripts window, hover over the script and click the Delete icon.
- In the confirmation window, click Delete again.
You cannot delete the BrowserStack library scripts, but you can delete your custom scripts.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!