Last updated on June 24th, 2025 at 05:03 am
This guide will show you how to use the
runScript
command in Selenium IDE to execute custom JavaScript during test execution. You’ll learn when and how to applyrunScript
for advanced scenarios, such as modifying page elements or triggering events dynamically.
New Test | ||
Command | Target | Value |
runScript | javascript{alert(” ‘DO YOU LIKE ALL THESE EXAMPLES? 🙂 IF YES THEN SUBSCRIBE VIA EMAIL TO GET MORE SUCH EXAMPLES ON YOUR EMAIL ID’ “)} |
CLICK HERE to view all examples of “runScript” command.
In above example, “runScript” command will run JavaScript snippet. You can provide your own JavaScript snippet in target of the command. Here, it will show you an alert message when you run it in selenium IDE.
My request to all my blog readers – Please share javascript snippet if you have used it for any purpose in selenium IDE by posting comment bellow.
One thought on “Selenium IDE – How to use runScript command in different ways with examples”
Hi Aravind,
thank you for very helpful posts.
How to call command line external tool from selenium ide.
For example i want to run dir command and get stdout in text.
I tried to use runScript using
javascript{ var exec = document.require('child_process').exec; exec('dir', function callback(error, stdout, stderr){alert(stdout); });}
but it raises error: TypeError: document.require is not a function.
Thank you.