Powered by Selenium IDE compatible commands

The open-source Kantu Webextension supports all important Selenium IDE commands. You find them on the Selenium IDE Commands page, along with some examples and "how to use" comments.

If your favorite Firefox Selenium IDE command is still missing, please let us know. And please report bugs to us and send us your new feature suggestions.

For the next update(s): Beta Testers wanted!

Join our Kantu Beta Tester List!

We run our own QA, but our resources are limited. Our QA can never cover the amazing variety of Kantu use cases and ideas that Kantu users have come up with. This beta program helps us to make sure that a new release does not inadvertently break existing macros. So please consider joining our beta version announcement list.

Flow Control

Kantu is the only web automation tool with built-in flow control commands like if/else/endif, while/endWhile or GotoIf. Follow the links for more details and examples.


Loop button

The dropdown next to the Play button contains the loop feature - run macros as a loop. Looping a macro is useful for doing basic load testing with the Selenium IDE, for performance monitoring or to simply test the stability for the test case (macro) itself. The csvRead command to read a CSV file line by line makes also use of the LOOP button.

Kantu for Chrome looping...


Read and write CSV files

Comma-separated values (CSV) files are useful as data input for data-driven testing/automation or as data output for web scraping. In Kantu for Chrome the csvRead command gives you access the data inside CSV files, and the csvSave command allows you to write test results or extracted values to a CSV file.

CSV Manager: Import (load) and export (save) CSV files from the Kantu extension

The CSV manager tab (shown in the screenshot) allows you to import, export, view and delete CSV files to the local storage of the extension. So the CSV files are not directly accessed from the hard drive, but they are stored inside the web browser. The reason for this is that modern browser extension have no access to your hard drive. Just like with the macros, all CSV files are stored locally inside your browser (technically called local storage), nothing is uploaded to any kind of cloud service.


Automating File Upload

This chrome extension can automate file uploads. To record file uploads, select the file with the file selection dialog as you normally would. Kantu records it. Just note that for security reasons Chrome only returns the file name and not the file path to the extension. Therefore the file path is always recorded as "c:\fakepath". So after recording, you need to edit the macro and replace c:\fakepath with the real path.

Automating File Download

If you all need is a simple download, there is nothing special to do. If a click command triggers a download, Kantu handles it automatically. By default, Kantu does not stop and wait for the download to complete, the macro continues with the next command(s).

OnDownload | new file name | (wait for download to complete:) true/false

For more control over the download there is the OnDownload command. It allows you to overwrite the default file name with a custom name. And with "true" in the 3rd column you tell Kantu to wait for a download to complete before continuing with the next command. Kantu waits for max. timeout_download seconds. This option is great for checking the performance (download speed) of a file download. If you need to measure the exact download time, you can do that with the value of the !RUNTIME internal variable. The max. wait time between a mouse click on the link and the actual download start is limited by timeout_wait. OnDownload can be at any place in the macro as long as it is reached before the download is triggered.


Internal variables

Some parameters can be controlled via Internal variables. All internal variables are valid only per macro run and they do not change the global default values. In other words, internal variables overwrite global default values inside the macro they are used.

  • !clipboard (read/write) - write to or read from the computer's clipboard (copy and paste).
  • !col1, !COL2,... (read only) - Values read from CSV file with csvRead
  • !csvLine (read/write) - storing values to this variable appends them to the line used by csvSave. Use store | NULL | !csvLine to overwrite (not append) the current values.
  • !csvReadMaxRow (read) - In some cases you may need to now how many lines are in a CSV file, or you want to read the last (most recently added) line of a CSV file. In both cases the internal variable !csvReadMaxRow can help. After the first csvRead, this value is set the number of lines in the CSV (example here)
  • !csvReadStatus (read) - true if the last csvRead command was successful. Typically false if there are no more lines in the CSV file. So together with the while command, this can be used to read CSV files where the number of rows is unknown. Please see the DemoReadCSVwithWhile macro for a code example.
  • !csvReadLineNumber (read/write) - true sets the line number for the csvRead command to read. If not used, the value of !LOOP is used for the line number and !csvReadLineNumber is set to the same value.
  • !ErrorIgnore (read/write) - This is a very useful internal variable. If set to true with store | true | !errorIgnore the macro execution continues after an error. It is often used with flow control or to test/click links that sometimes exist and sometimes not. You can change back to the normal behavior at any point in the macro with store | false | !errorIgnore
  • !LastCommandOK (read, DEPRECATED, use !statusOK instead) - contains the status of the last executed command (true of successful, or false if the command encountered an error. Use with !ErrorIgnore set to true so the macro execution continues after an error. The ECHO command that does not influence the status, so it can be used for logging the value of !LastCommandOK without changing its value.
  • !statusOK (read/write) - contains the status of the macro execution. Once an error happens statusOK is set to FALSE. Use with !ErrorIgnore set to true so the macro execution continues after an error. Only then !statusOK will be useful. Otherwise the macro stops at an error anyway.
  • !LOOP (read only) – current value of the loop counter (1,2,3… etc). Great for use with @POS=${!LOOP} to cycle through a list of links.
  • !MACRONAME (read) - Name of the macro this command is in
  • !REPLAYSPEED (read/write) - Set the replay speed to FAST (no delay between each step), MEDIUM (short, "human like" delay) or "SLOW" (2 seconds delay)
  • !RUNTIME (read) - Time elapsed since macro start. This value is very useful for performance testing and performance monitoring
  • !TIMEOUT_DOWNLOAD (read/write) - Time limit for file downloads if Kantu is told to wait for a download to complete via OnDownload | file name | true
  • !TIMEOUT_MACRO (read/write) - Limit for the overall macro runtime. The default value is 300s (5 minutes).
  • !TIMEOUT_PAGELOAD (read/write) - How long to wait for page load
  • !TIMEOUT_WAIT (read/write) - How long to wait for an element to appear before reporting an element not found error (implicit waiting)
    Implicit waiting with timeout_wait in action
  • !URL (read only) - contains current browser URL that you see in the address bar. Previously, the storeLocation command was needed for this.
  • !WaitForVisible - by default the implicit waiting waits for an element to appear and become visible. If you do not want to wait for the element be visible (typically because it never becomes visible) use store | false | !WaitForVisible. Then waiting for visible is turned off for all following commands until you set it again to true.


Performance Monitoring/Testing

The !RUNTIME internal variable contains the macro runtime and makes performance testing easy. In the example below we first click on the "Start OCR button " (OCR.space) and store the current run time in a variable. Then Kantu waits for the result (= web element) to appear. Once the element is found and the macro execution continues we measure the time again by reading the current value of !RUNTIME. The difference is the runtime performance of this step. In a next step you can, for example, write the value of "TimeForThisStep" to a CSV file with the csvSave feature.

Performance Monitoring/Testing

The !RUNTIME internal variable contains the macro runtime and makes performance testing easy. In the example below we first click on the "Start OCR button " (OCR.space) and store the current run time in a variable. Then Kantu waits for the result (= web element) to appear. Once the element is found and the macro execution continues we measure the time again by reading the current value of !RUNTIME. The difference is the runtime performance of this step. In a next step you can, for example, write the value of "TimeForThisStep" to a CSV file with the csvSave feature.

click link=Start OCR! Start the process to measure (in this case an OCR conversion)
store ${!RUNTIME} StartTime Store the start time
click //*[@id="sucOrErrMessage"]/strong Wait for the "Completed" message to appear...
store ${!RUNTIME} EndTime Log the current macro runtime
storeEval ${!EndTime}-${!StartTime} TimeforThisStep Calculate the runtime of the "yellow" step,
which is the difference between start and end time.

Test status reporting

The background of each macro indicates its test status: White = not yet run, Green = last run was ok and red = last run had an error.

Test status indicator...

Setting the right macro replay speed

In (gear icon) > Replay Settings you can select the replay speed. FAST (no delay), MEDIUM (0.3s, default) and SLOW (2s). With FAST, Kantu replays the macro as fast as it can. This is faster than any human could type, so on some websites that can cause problems, as they have not been tested for such a speed and sometimes Javascript code can not respond quickly enough. Typically MEDIUM is a good compromise between speed and being website-friendly. SLOW can be useful for testing and debugging.

You can change the default replay speed in the settings menu (see screenshot above) or inside a macro with store | SLOW/MEDIUM/FAST | !replayspeed.


Position support in link text locator

With CLICK link=Download@POS=3 you instruct the IDE to use the n-th (here n=3) occurrence of a locator. This is useful, for example, if a have a website with many download links, and you want to click the n-th once. POS is only supported with the “normal text” locator link=... but not with XPATH and CSS selectors.


More Example Macros (Test cases)

The Kantu Selenium IDE github page contains the /testmacros folder with plenty of test macros. You can download and import all macros/selenium IDE scripts at once. For this, use the "Gear icon => Import HTML" feature and then select all the macros/scripts that you want to import (we call the test cases often macros - this is the same. We use the word macros as some users use the extension not for web testing, but for web automation. There the word macro and macro recorder is very common.)

Import many macros at once! - and do not forget to BACKUP (export) your macros once in while


Tip: Backup your macros

All macros are stored inside your web browser in what is called technically HTML5 local storage. Nothing is copied or moved to the cloud. This means that once you uninstall the Kantu extension, your macros are gone! Please use the "Export", "Export All" feature to create backups of your important test cases. You can also use the "Backup" button on the backup settings panel to backup everything at once.


Command Line Support

Save the macro (= your Selenium IDE test case) in HTML format with the "Save HTML page" export feature. The export feature automatically adds some Javascript helper code to the exported HTML page that enables the autostart.

Create the HTML page for the command line autorun feature

Then load the website in the web browser - and the macro runs automatically! By default, the autorun feature is enabled for local websites and for the bookmark feature (see below), but not for starting macros from normal (internet-based) websites. To skip the "Do you want to run this macro?" question, add the "?direct=1" switch to your local file URL ("file:///...").

Command Line Parameters

Note that in a strict technical sense these are not command line parameters, but "GET" parameters that are appended to the file URL of the autorun HTML page(s) you are loading into Chrome. But their purpose is just like that of real command line parameters, so we call them this way.

  • - direct=1 - Skip the "Do you want to run this macro?" question
  • - close=1 - Close all tabs (close Chrome) when the macro has completed
  • - savelog=filename.txt - This saves the log (content of the Log tab) plus a header status header as a text file once the macro has completed. The log is saved whether the run was successful or not. The calling script (e. g. Batch file, Python or Powershell) can check for the existence of this file to make sure the macro run completed). The first line of the log file is always the status of the macro run (error or success, and the error message, if any).

Run Selenium IDE from the command line

Allow Kantu access to file URLs: Allow access to file URLs

Example: A Windows batch file to run a Selenium IDE/Kantu macro from the command line on looks like this:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "file:///D:/mytestcases/DemoAutofill1.html?direct=1&close=1&savelog=log1.txt"
Windows is used as an example here, the command line feature also works on Mac and Linux as well. "demoautofill.html" is the exported Kantu macro. Note that you must use file:/// for the file path. If you would just start with "C:\..." you will get a "file not found" error for the HTML file due to the appended "?direct=1&close=1&savelog=log1.txt" GET parameters.

Short animated GIF of the command line in action. Note that the Kantu extension closes automatically if the macro run was successful.: Kantu Selenium IDE: Start selenium ide scripts from the command line

Run from bookmarks

In the macro context menu (right-click menu) select "Create bookmark". This adds a shortcut to the macro to the macro to your bookmarks. From now on you can just select the bookmark to run the macro. Kantu will open to run the macro and then close again. But if the macro encounters an error, Kantu stays open so you can see what went wrong. Add web macro shortcut to bookmarks bar

Technically Kantu bookmarks are little Javascript snippets (bookmarklets) that start the Kantu engine. And thus, like with all bookmarklets, they do not work on the Google Chrome and Firefox "New Tab" start page. For security reasons, the browser do not run any Javascript on this page. But whenever a "normal" web page is loaded, the kantu web imacro bookmarks work great. Bookmarklets need a normal web page loaded to work (= do not work on new tab page)

Password Encryption (*Beta*)

Kantu can store text from password fields encrypted. You can enable this feature and set a master password in the settings.

IMPORTANT: This feature is under development and the encryption method and password storage format might change with the next update.

Test Suites

Test suites are created on the test suites tab by selecting the test cases (macros) from the drop-down. Click the "+Macro" button to add a new macro to the list. You can also specify how often each macro runs (loops). Test suites itself do not contain macro code, they contain the names of existing macros.

Once the test suite is completed, a test report summary is written to the log area. The success of each test case is also indicated visually.

To rearrange the order of the macros in the test suite and for other larger changes, we recommend to edit the JSON source directly. To edit it, either click the "hamburger icon" ☰ displayed to the right of the test suite name, or right-click the test suite name and then select "Edit source".
Edit the test suite JSON source
Once you save the edited source code, Kantu runs a checks against all available macros to make sure there are no missing macros or typos.

Global variables: By default, each macro runs independent, no variables are shared. But you can create global variables that are available to every macro and test suite simply by prefixing them with "Global..." (e. g. "globalMyCounter" or "GLOBAL_username"). In other words, variables whose name starts with "Global..." are shared . Global variables keep their value even after the macro has been stopped. Their content is only lost once Kantu is closed.

If you want your data to survive a closing of Kantu, then store ("persist") it in a CSV file with csvSave and csvRead:
Use global variables or CSV files to persist data

Command Reference

There is a Selenium IDE Command Reference table available.

Test and Demo Macros

Often it is best to learn from examples. There is a longer list of demo macros available at Github.

For developers

The full source code of Kantu for Chrome is available on GitHub (License: GNU).

Subscribe to the a9t9 automation software newsletter . We'll send you updates on new releases that we're working on.