Kantu Webextension's Selenium IDE commands

The table below has an overview of all supported Selenium IDE commands along with some comments. Each command is linked to a details page with more information and some example code. The most important commands are marked GREEN (useful for beginners). Commands that are new and not backward compatible with the old Firefox IDE are marked YELLOW (useful for experts and web testers upgrading from the classic Firefox Selenium IDE). Furthermore, the Kantu Selenium IDE has built-in flow control, supports all possible selectors and uses implicit waiting.

Command Target Value Comment
answerOnNextPrompt The string to be set to the next prompt pop-up
AssertChecked A locator Continues test only if a checkbox or radio button is checked
assertAlert, assertConfirmation, assertPrompt The expected alert/Confirm/Prompt message
assertElementPresent Checks if the element exists on the page.
assertText A locator The expected string of the target element (Exact matching). Variable declared in the storeXXX commands can be used in the string. For example: "Hello ${varusr}"
assertTitle The expected string of the title (Exact matching).
captureScreenshot file name Captures the contents of the OS view port (i.e. whatever is currently being displayed on the monitor). The screenshot is displayed in the "Screenshot tab". From there, you can export it.
captureEntirePageScreenshot file name Captures the contents of the entire website. The screenshot is displayed in the "Screenshot tab". From there, you can export it.
A locator Clicks on the element. The "..andWait" version then also waits for a page load event." -
clickAt A locator x,y position of the mouse event relative to the target element. For example: "10,10"
chooseOkOnNextConfirmation Kantu closes dialogs automatically. In other words, chooseOkOnNextConfirmation is a built-in behavior, and no longer a separate command.
csvRead name of CSV file Reads one line of the CSV file and makes the values available in ${COL1}, ${COL2}, ...and so on. Important: To submit more than just the first line of the CSV file, you must start the macro with the LOOP button. Each loop reads one line of the CSV. The line read is based on the value of the ${!LOOP} counter variable.
csvSave name of CSV file Saves the line that was built store | value | !csvLine to a file inside the Chrome storage (not to your hard drive)
deleteAllCookies Deletes all cookies
dragAndDropToObject The locator of the element to be dragged The locator of the element on which the target element is dropped
echo The string to be printed in the log console.
editContent locator text in HTML format
highlight locator No longer needed. The new IDE highlights all found elements by default. You can disable highlighting in the settings.
open A URL New: Open supports full URLs like https://heise.de as well. In this case the base URL is ignored.
mouseOver locator
pause The amount of time to sleep in millisecond. For example: "5000" means sleep for 5 seconds.
sourceExtract search string or regex variable Extract data and stores it in variable. Works with the page source, instead of looking at the web page object model (DOM).
sourceSearch search string or regex variable Counts matches and stores the result in a variable. Works with the page source, instead of looking at the web page object model (DOM).
Refresh Refreshes (reloads) the current page-
A locator of a drop-down menu An option locator. For example: "label=Option1" (...andWait: plus waits for page load event)
selectFrame "index=0" (Select the first frame of index 0)
"relative=parent" (Select the parent frame)
"relative=top" (Select the top frame)
Works for frames and iframes
selectWindow Auto-generated Switch browser tabs. In addition to the tab name value, you can use numbers tab=0,1,2,3 to switch tabs. Tab=0 is current tab, 1 is one to right, etc.
sendKeys A locator A character. For example: "${KEY_DOWN}"
store A string The name of the variable storing the string. For example: "var_usr" Note: System variables start with ! like !TIMEOUT_WAIT. So you can not create a variable that starts with ! (=> error message)
storeAttribute ….href …alt Variable to store the attribute in it
storeChecked A locator variable to store the result in result is true if the radiobutton or box is checked, otherwise false
storeEval Javascript to run... Variable to store the result in (optional)
storeText A locator The name of the variable storing the text of the target element. E. g. "abc"
storeTitle (the title of the website) The name of the variable storing the title e. g "mytitle"
storeValue A locator The name of the variable storing the value of the target element. E. g. "phone"
storedVars used inside storeEval and other places
ThrowError Your error message This command triggers an error. It stops the macro execution and displays "your error message" in the log file. Together with if/endif it allows you to create your own error conditions.
type A locator The string to be set to an input field. This command erases box content, but sendkey does not
VerifyChecked A locator Logs if a checkbox or radio button is checked
verifyElementPresent Checks if the element exists on the page and logs error if not.
verifyText A locator The expected string of the target element (Exact matching). The next command will still be run even if the text verification fails.
verifyTitle The expected string of the title (Exact matching). The next command will still be run even if the text verification fails.
These commands are no longer needed, as the Kantu IDE uses implicit waiting, just like webDriver
waitForPageToLoad Wait for the page to be fully loaded. Normally not needed as all "...andWait" commands include it e. g. in ClickandWait
waitForVisible Waits for the element to be visible.

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 Commands

The Kantu Selenium IDE has built-in gotoIf, gotoLabel and while loop functionality. The commands in this table are inspired by the Flow Control addon (SelBlocks) of the classic Selenium IDE.

Command Target Value Comment
if-else-endif Javascript to evaluate The classic if-then-else conditional. If the expression evaluates to TRUE the "then" section is executed, otherwise the "else" section is executed. Often used with !LastCommandOK
gotoIf Javascript to evaluate Label If the expression evaluates to TRUE the execution jumps to LABEL, otherwise continues with the next command. Often used with !LastCommandOK
gotoLabel Label Jumps to LABEL. Helpful to built if/then/else functionality.
label Label Defines the LABEL position for gotoIf and gotoLabel to jump to.
while Javascript to evaluate Executes the section between while...whileEnd as often/as long as the conditional statement evaluates to true.
endWhile Defines the end of while...whileEnd section.


Flow Control and !statusOK

!statusOK is an internal variable that contains the status of the last executed command. Thus its value is true if the command was successful or false if the command encountered an error. It is typically used with !ErrorIgnore set to true so the macro execution continues after an error.

set true !errorignore Allow the macro to continue after the error (not needed if you check only "verify..." results)
click //*[@id="sucOrErrMessage"]/strong Link to click (any other command also works with !LastCommandOK)
GotoIf ${!statusOK} COMMANDOK1 Jumps to the COMMANDOK1 label if the click command worked
GotoIf !${!statusOK} COMMANDERROR1 Another option: "!" inverts the result. So here we jump if the click command had an error. See the screenshot below:

${!statusOK} and GotoIf in a macro. Notice ! in front of the variable. This is the Javascript notation to invert results.:
!statusOK and GotoIf in a macro:

Implicit Waiting

Just like webDriver, the new IDE uses implicit waiting:
Sometimes elements take some time to appear on the page Previously, waitForElementPresent was needed to pause selenium until the element appears on the page on the page. Now with implicit waiting the Selenium IDE (and the Webdriver) poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available. In webDriver language this looks like driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);. With the IDE, you can use the built-in variable !TIMEOUT_WAIT to define the amount of time Kantu needs to wait during replay. If not defined, the global value from the settings page is used.


Flow Control and onError

  • - onError | #restart => Restarts the macro if an error happens (same as manually clicking PLAY again - this resets all variables and counters, except the global variable)
  • - onError | #goto | LABEL => Jumps to "LABEL" if an error happens. You find an example in the DemoIfElse macro.

Supported selectors/locators

"Selector" or "Locator" are two words for exactly the same thing: A little piece of text or code that tells Kantu on what element you want to click or send keystrokes to. The Kantu Selenium IDE supports all selectors:

  • - ID
  • - Name
  • - Link and link@POS
  • - Css
  • - Xpath

Select different selectors during recording with the Selenium-stye IDE
During recording, the Kantu IDE selects (what it thinks is) the best selector, but other options are available in the dropdown as well. These additional options are available during recording and before you switch to another macro. The reason for this is that the additional options are not saved. In other words, only one selector is saved in the macro, not the complete list of options. Kantu offers different selectors during recording

After recording, you can use the "Select" button to update a locator, and "Find" to search for a locator on the website. Selenium IDE Find and Search buttons


Demo Macros

The ready-to-import-and-run source code of all demo macros can be found in the Github repository testmacros folder.

Import existing test cases from the classic Selenium IDE

Kantu can import and export test cases from the classic Selenium IDE. To import your test cases, select the "Gear icon" on the "Macros" tab, then select "Import HTML". Test cases in HTML format use the original Firefox Selenium IDE test case format. In the file dialog, you can select multiple HTML files at once. So you can import all your test cases at once.

To export test cases in the original Selenium IDE HTML format, right-click on any macro, then select "Export as HTML (plus Autorun)". The included little autorun Javascript code is used for the Kantu command line feature. It does not influence the HTML import back into the Selenium IDE or any other tool that can read the classic Selenium IDE file format, as it gets simply ignored on import.

See also

Web Automation Extension User Manual, Selenium IDE commands, Classic Firefox Selenium IDE.


Anything wrong or missing on this page? Suggestions?

...then please contact us.

Kantu Selenium IDE for Chrome and Firefox - Web Test Automation Top
Subscribe to the a9t9 automation software newsletter . We'll send you updates on new releases that we're working on.