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. Also please report bugs to us and send us your new feature suggestions.

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.

Top

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 LOOP button is also used with csvRead to read a CSV file line by line.

Kantu for Chrome looping...

Top

Read and write CSV files

Comma-separated values (CSV) files are useful as data input for 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.

Top

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.

Some background information: The file upload feature uses the Chrome debugging api to automate the file upload. So this featue is the reason why our chrome extension requests debug permissions.

Top

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.
  • !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) - 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.
  • !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.
  • !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 elment 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 storeLocator command was needed for this.

Top

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.
Top

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.

Top

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 the “normal text” locator link=... but not with XPATH and CSS selectors.

Top

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

Top

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 also means that once you uninstall the Kantu extension, your macros are gone! Please use the "Export", "Export All" to feature to create backups of your important test cases. You can also use the "Backup" button in the settigns to backup everything at once.

Top

Command Line Support (*Beta*)

Save the macro (= your Selenium IDE test case) in HTML format with the "Save HTML page (old) export feature (ignore the word "old" here, this refers only to the HTML format syntax, which is based on the old Firefox Selenium IDE). 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! Note that the autorun feature is disabled by default. To use it, check the "Run from command line" checkbox. You find it in the Replay settings: (gear icon) > Replay/Record tab. Run Selenium IDE from the command line

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

Enable the command line feature in the Kantu replay settings: Run Selenium IDE from the command line

Example: A Windows batch file to run a Selenium IDE/Kantu macro looks like:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" C:\kantu-macros\demoautofill.html
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.

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 (*Beta*)

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. If the macro hit an error, then Kantu stays open. Add web macro shortcut to bookmarks bar

Macro bookmarks require that the "Run from command line" feature is enabled. You find the setting in (gear icon) > Replay/Record tab: Run Selenium IDE from the command line

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.

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).

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