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.
click,
clickAndWait
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"
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.
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.
Refresh Refreshes (reloads) the current page-
select,
selectAndWait
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.
waitForElementPresent
waitForElementToLoad
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

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.

Top

Flow Control and !LastCommandOK

!LastCommandOK 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 ${!LastCommandOK} COMMANDOK1 Jumps to the COMMANDOK1 label if the click command worked
GotoIf !${!LastCommandOK} COMMANDERROR1 Another option: Here we jump if the click command had an error: Notice ! in front of the variable. This is the Javascript notation to invert results.

${!LastCommandOk} and GotoIf in a macro:
!LastCommandOk 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.

Top

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

Top

Demo Macros

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

See also

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

Top

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.