Getting started

Start by watching the 120-seconds Kantu video below. Then run some or all of the included demo macros. This will give you a good feeling of what Kantu can do. After that, you are ready to record your first macro.

Kantu is fun to use! But if you have no time to create automation scripts you can buy Kantu PRO. The license includes 3 hours of custom script creation services to get you started. So you just tell us what you want to automate, and Kantu tech support creates the macros and scripts for you.

Kantu Recording

To create your own image macros, click the "tape icon" and the image wizard appears. It helps you to take the screenshots for your macro.

  • Resize the screenshot area to fit your button or text box. In general, a smaller screenshot is better and faster.
  • Select the action to perform on the screenshot: Click or Click+Type (for sending text to input boxes)
  • . For web testing, there is also Find to assert a certain image is on the screen.
  • Click "Add" to record the screenshot and command
  • When you are done with recording, click stop.
  • Save the macro under a new name.
  • Select Play to run your macro.
Screenshot web automation with Kantu Tips:
  • The scroll command allows you to move up and down the screen.
  • You can use the "Comment" box to add a note for later
  • No worries: Wrongly recorded commands can be removed or changed in the editor after recording
Record screenshots step by step

Top

Use the Editor to fine-tune

The Kantu Editor allows you to add and remove recorded commands, and also to easily rename and change images. For this, it has a built-in screenshot tool.

Editor

Top

Automating File Downloads

Just trigger the file download like you normally would do, this time using the image wizard. Kantu records it by adding a SET DownloadDirectory... value.

Top

Automating File Uploads

Automating web browser file uploads is very easy with Kantu: Create a click command with the screenshot of the file upload "Browse" button and then select the file you want to upload from the native browser file upload dialog that appears. That is all. Kantu records path of the selected file and then fills it in during replay. Kantu works with all file upload methods that you can find on the web (We tested dozens of websites and it worked with all. If you come across any that does not work, contact us.)

Editor

Special feature: Folder upload: If you specify a folder name instead of a file name, Kantu will upload every file in the folder. To do so, set the loop counter (at the very bottom of the right sidebar) to a value > 1. With every macro loop, Kantu grabs a new file from the folder and fills its file name to the upload box. Kantu selects the files to upload alphabetically a-z.

Top

Automating Select Boxes

Automating selected boxes can be sometimes a bit tricky. On the one hand there are modern-style select boxes (Example: Gmail sign-up dialog). These can be automated just like any other element on the page.

The tricky part are only the “classic” old-style select boxes. You can detect them as you will be unable to create a screenshot of them with the wizard. And sometimes they overlap the recording wizard once open. And in any case, they look old and very “Web 1.0”.

Editor

To automate these kind of select boxes you have to use keyboard events: To select an entry from select boxes, please enter {DOWN} to select entries. If you want to select the 3rd entry, then enter {DOWN}{DOWN}{DOWN}. Then send {ENTER}. So the complete sequence looks like

{DOWN}{DOWN}{DOWN}{ENTER}

You can also tell Kantu to type the first character of an entry. Example: To select Germany in a typical country list, type "G" and then 3-times down:

G{DOWN}{DOWN}{DOWN}{ENTER}

Typing “G” will jump to “Gabon” and from there you are only 3 times {DOWN} away from Germany.

Web Scraping/ Data Extraction

The new Kantu Version has full support for data extraction via the API. For more details, please see the visual web scraping page.

Visual Web Scraping with OCR

Looping a macro

In web testing you often need to replay a macro more than once. Kantu has a built-in function for that: Enter the desired number of loops in the field and then press Play. Another method to loop a macro is to use the PLAY command provided by the API and call it for example within a FOR...NEXT loop of your favorite scripting language.

Drag & Drop

Drag & Drop support will be available soon. Please contact tech support for access to an internal beta version.

Data-driven testing/automation with CSV files and databases

There are two ways to import CSV data into Kantu:

(A.) Built-in READCSV command

You add the SET READCSV YourCSVfile.csv to the macro and Kantu loads it for you. The data from the CSV file is now available in the internal variables {{$COL1}}, {{$COL2}} and so on. Kantu loads a new row of the CSV file with every macro loop – so it is important that you set the loop counter (bottom right corner) to a value > 1. Typically, of course, you will pick a loop counter value matches the number of rows in your CSV file. Related demo macro "Demo-ReadCSV". It shows how to use a CSV file to populate multiple form entries.

(B.) Use the Scripting API [PRO]

This approach gives you the most flexibility. You can use the API not to read data from CSV file, but from any datasource (SQL, Access, ODBC,….). To do so, use the API to send data to Kantu. A VBS example script that reads from a CSV file and sends the data to Kantu for form filling is in our Kantu API GitHub repository.

Note that while CSV files (CSV is a comma separated values file) are the most popular way to store and read data, the API allows you to connect Kantu with databases or any other datasource as well.

Execute JavaScript (Content Scripts)

Sometimes visual automation is not enough, and you need to query website elements directly. Or you need the power of Javascript to generate custom values like "Yesterday's date" or "Random number between 200 and 250". Kantu includes the Javascript command for such tasks. It allows you to do everything JavaScript can do, but inside the visual Kantu macros. As Kantu builds on Google Chromium, its Javascript command is compatible to Chrome content scripts. Run the "Demo-Javascript" macro that ships with Kantu to see some scripts in action.

Example 1:Set a select box to a certain value:
var e = document.getElementById('tesla'); e.value = "y";

Example 2: Get today's date:
var today = new Date(); var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate(); var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(); var dateTime = date+' '+time; return dateTime;.
The return value of the script is available with the {{$JSRESULT}} internal variable.

Run Javascript inside a Kantu macro:

Top

Adobe Flash testing/automation

Kantu's visual approach is ideally suited for automating and testing Flash applets. To get started, you only need to install the latest Adobe Flash Player. This takes less than one minute, please follow the instructions here.

Top

Command Line Options

You can run Kantu from the command line/batch file:

  • Kantu.exe macro.kmacro => opens Kantu and runs macro.kmacro. Kantu stays open after the macro is completed.
  • Kantu.exe macro.kmacro -ae => opens Kantu, runs macro.kmacro, and then closes Kantu (ae = and exit). This is the recommended syntax if you start Kantu from a task scheduler.
  • Kantueditor.exe macro.kmacro => opens macro.kmacro in the Kantu Editor

Schedule Tasks: If you need to run macros periodically you can use Kantu with the built-in Windows task scheduler. By using Task Scheduler, you can schedule tasks such as uploading a file or filling a form at a defined time. The Task Scheduler takes care of this. It runs in the background, checking if any scheduled task is due. You can schedule a task to run daily, weekly, monthly, or at certain events such as system startup. Kantu supports headless mode.

Top

Use the Kantu Browser Scripting API [PRO]

For more complex automation, there is the Kantu Browser API. It can be used from any programming or scripting language. Some VBS and PowerShell sample scripts are included. As a start, run them to see what the API can do.

Browser API

Easy to use API, works in any programming or scripting language on Windows

With open you launch Kantu instances, and with play you run the image macro. All commands return detailed status and error information at runtime. Tasks you can use the API for include "if/then" decisions, reading form-filling data from a text file ("data-driven testing") or storing extracted information in a database.

For more details see the API command reference below.

Top

Kantu - FAQs

Top

What does "Confidence level" mean?

Another, maybe better name for it is ''similarity score'' (and we will change to that name with the next update). => What it means is the similarity between the input image (e. g. the button image) and the best found match on the website. A score of 1 means perfect match, and a score of, say 0.8, allows for some deviation between the images The image search algorithm scores every possible match with such a score. And if you set the similarity score threshold e. g. to 0.8, but the best possible match found is only 0.78, then Kantu will report this as "image not found" error. On the other hand, if the best possible match found is 0.83, then all is fine and Kantu will click the button and continue.

Why is this needed? Technically images are rarely rendered exactly the same between two machines. There are artifacts from the JPG compression, browser rendering, screen resolution or the image you are clicking changes a slightly different shade during mouse over. So the goal of the employed pattern matches algorithms that Kantu considers an image "the same" if a human would say it is "the same".

For example, an image that has a similarity score of 0.95 on your regular work PC might have the same score inside a VM on the same PC, but only a similarity score of 0.56 on a Surface Tablet with its High-PPI screen. In other words, a confidence 0.5 is usually a very good and stable default value.

Top

How to create IF THEN ELSE statements with Kantu?

Community and PRO Edition: The Javascript command allows you, among many other things, to make if/then decisions within the command.
Example: var hour = new Date().getHours();if (hour >= 9 && hour < 18) { text = "store open"} else { text = "store closed"}; return text;

PRO Edition: Kantu separates the linear website flow logic (the Kantu screenshot macro) and the programming/scripting logic via the Scripting API. So for tasks like conditional statements, the Scripting Interface is the best solution. The PLAY command always returns detailed status and error information, and use can use this to base your IF/THEN/ELSE decisions on:

IntegerReturnValue = objKantu.Play ("macro1")
if IntegerReturnValue = 1 then
'Do something
MsgBox "OK!"
else
'Do something else
IntegerReturnValue = objKantu.Play ("macro2")
end if

This example uses the VBS/Visual Basic syntax, but you can use any programming or scripting language with the Scripting API.

Top

How do I add additional steps to an existing recording?

You can use the Kantu Editor to copy & paste lines between macros: So you would first record macro A, then record the additional steps as macro B, and then copy & paste some or all lines of it into macro A.

Top

Can Kantu run in headless mode? [YES]

Unlike most other visual automation solutions, Kantu Web Automation runs fine in headless mode (no physical monitor connected). This feature comes out-of-the-box, it requires no special settings or setup. Just start Kantu via command line or API. This also means that Kantu automation runs just fine on disconnected RDP (remote desktop connection) sessions, behind a Windows lock screen, inside VMware/Vbox/HyperV virtual machine or when started by the Windows task scheduler.

Web testing specific FAQs are on the web testing FAQ page.

Top

Kantu Command Reference

This chapter lists all Kantu macro commands. The compressed Kantu macro ( = .kmacro) files are standard zip files. If you rename *.kmacro to *.zip you can open and edit them in Windows Explorer or any other file manager. Some file managers such as Total Commander are even smart enough to let you open the .kmacro files without renaming the extension first. A Kantu macro consists of a .json file with the macro commands and the corresponding images in .png or .jpg format (.png recommended).

Click (and Right-Click)

Find the target image and click in the center of it. As any command that takes an image as input, the CLICK commands waits until "timeout" for the image to appear. The default is 12s. You can change the value either globally in the settings dialog or inside the Kantu macro with SET FindImageCommandTimeout (new time). Also, by default all image commands search only on the visible part of the screen for a better performance. You can change this by adding SET SearchImageInWholePage "true" to the macro. The Right-Click command works the same, but simulates a mouse-right-click. Typically websites like Google Docs use right-clicks to open context-sensitive menus.

Click & Type

This combines a Click and a Type command into one command. Typically this is used with input boxes. It find the target image, click in the center of it and sends text.

  • {DOWN} and {UP} - Useful to move through values in select boxes
  • {ENTER}
  • {TAB} - Use it to jump between input fields
  • {LEFT} and {RIGHT}
  • {BACK} - Delete pre-filled characters
  • Need other values? Please ask tech support.

Find

Find (assert) the target image is loaded.

Javascript

Execute Javascript on the loaded web page. Great for accessing the DOM and making basic IF/THEN decisions.

Extract

Extracts data from the website. The data is returned via the API interface.

Navigate (URL)

Loads a website. Kantu does not "wait" for a website to be loaded. The "waiting" is implicitly done by the image recognition of the FIND or CLICK commands.

Screenshot

This commands takes a screenshot of the website and saves it to file. The options are "full" (whole page) or "partial" (visible part).

Scroll

This commands scroll the page up or down. Why is this useful? By default, the image recognition of Kantu operates on the visible part of the screen, so by scrolling up or down you can reach other parts of the website.

    Values:
  • Top - scroll to top (~ "Home" key for humans)
  • UpPage - scroll one page up (~ "Arrow Up" key)
  • UpHalf - scroll half page up
  • DownHalf - scroll half page down
  • DownPage - scroll one page down (~ "Arrow Down" key)
  • Bottom - scroll to the very end (~ "End" key)

Recording SCROLL.
Screenshot: Recording the SCROLL command with the recording wizard.

You can change image search area with the SearchImageInWholePage parameter. It is set to false by default (ie. only the visible part of the page is used).If you want to set it so the image detection use the whole page during

SET (Parameter)...

This commands sets internal values for the Kantu replay engine. Values set inside a macro override global values. For example, if the global replay speed is set to "Slow", a SET ReplaySpeedMode = FAST will overwrite the value for the macro itself, but not change the global setting. Do not confuse this command with the API command setVariable.

  • ReplaySpeedMode - Fast. Medium or Slow. This overrides the global settings for the specific macro
  • DeleteAllCookies - Removes all cookies. Note that some cookie types are only really gone after a browser restart. (You can automate a browser restart via the Kantu API.)
    If you want to remove absolutely every data that the Kantu Chromium Browser stores, manually delete its cache. You find it at C:\Users\***your user***\AppData\Local\Temp\Kantu\cache. Delete the \cache folder and restart Kantu.
  • DownloadDirectory (string) : The path where the downloaded files should be stored during a record/replay. It overrides the global value set in the app settings.
  • FindImageCommandTimeout (int) : Timeout, in ms, to use for every IMAGE commands during a replay. It overrides the global value set in the app settings.
  • SearchImageInWholePage (boolean): It is set to false by default (ie. only the visible part of the page is used). If set to "true" the whole website is used for the image detection. This applies to all image related commands (CLICK, CLICKTYPE, EXTRACT, FIND). [PRO Edition feature]
  • ExtractAdd Adds a custom value to the list of extracted data. You can add for example the JS return value {{$JSRESULT}} or any other internal value to your extracted data.
  • ReadCSVSpecify the CSV file to read data from. The number of columns is auto-detected. The data is available in the {{$COL1}},{{$COL2}}...{{$COL9}} variables.

Use SET to tell Kantu to search the whole page.

The screenshot shows the SET command dropdown box inside the Kantu Editor.

Wait

Waits x milliseconds. It is not required to use Wait with the image commands.

List of internal variables

Internal variables expose some Kantu data for use inside your macro and Javascript. Most internal variables are "read-only", unless explicitly mentioned. Do not confuse these internal variables with the API command setVariable, that allows you to create your own variables to send data to Kantu macros.

  • {{$BOX1}}...{{$BOX9}} - content of the last pink frame(s) of an EXTRACT command. Use it, for example, to fill extracted data back into a form.
  • {{$COL1}}...{{$COL9}} - content of CSV file (read line by line during loops)
  • {{$FILE.UPLOAD}} - name of file the select for upload. Useful if you use the folder upload feature and want to fill in the current file name somewhere.
  • {{$FOLDER.DOWNLOAD}} - location of the current download folder
  • {{$JSRETURN}} - return value of the last Javascript command
  • {{$MACRO.NAME}} - name of the running macro. Useful, for example, as part of file names
  • {{$LOOP}} - number of the current loop. Starts with 1 (not 0)
  • {{$PASTE}} - content of the clipboard

Kantu API Reference [PRO]

This chapter lists all commands that are available from the Kantu scriting interface (API).

Example code/scripts for using the API from C#, Java, Python, Powershell, VB6, VBS and VB.NET are available in the Kantu Kantu API GitHub Repository.

objKantu = CreateObject ("Kantu")

Example objKantu = CreateObject ("Kantu").

Connects to the Kantu Browser API. The API is technically designed as a COM object, so it works with any programming or scripting language on Windows. They all support talking to COM objects. Now you can access all commands via the “objKantu” object just created: intReturncode = objKantu.CommandName

Open(true/false)

Syntax: iret = objKantu.open(true)

  • open(true) - Opens the Kantu browser.
  • open(false) - connects to an existing, already open instance.

For experts: You can modify the default timeout that the API waits for Kantu to launch by using objKantu.Open(true/false, new timeout value in seconds). The default timeout value is 60 seconds, which is normally more than enough to launch the Kantu Browser. However, if you are launching many instances of Kantu at once, and the CPU usage is close to 100%, then it can take for longer. The option to increase the .Open timeout was added for this case.

objKantu.echo (“Text”)

Displays a text string on the Kantu GUI. Try it :)

objKantu.setVariable (“VariableName", Value)

Set values in your programming language and Kantu uses them in the kmacro macros, for example {FirstName}. This command is for the custom variables (= variables that you create). It should not be confused with the SET command inside the Kantu macro, which is designed to set the built-in variables like ReplaySpeedMode, DeleteAllCookies, DownloadDirectory, FindImageCommandTimeout or SearchImageInWholePage.

Variables are only parsed in the “Value” field of a command. So you can not use them (yet= to replace/change for example parts of the URL in the “OPEN” command or change the images or other values. Meanwhile, contact tech support for some workarounds.

objKantu.Play("macro.kmacro”)

This is the most important command - it plays the .kmacro macro. If the macro completed OK, the command returns 1. If something went wrong a negative value is returned. The GetLastError function provides detailed error information on what went wrong.

Timeout value: Play and all other commands have a default timeout. This timeout avoids that the calling scripts waits "forever" in case the Chromium browser engine crashes or freezes. If this happens, the Play command returns after the timeout is expired. If the Kantu browser (and/or the Google Chromium engine inside it) is frozen, it is closed by the API. So the API object operates independently of the Kantu Browser. It runs in a separate process.

Important: The timeout might also trigger an error if the macro simply runs too long (longer than the timeout value). The solution for this case is to overwrite the default timeout value (60 seconds) by adding your own time like this:

objKantu.Play ("macro.kmacro", 300)

In this example the Kantu API will wait 5 minutes (300 sec) for the PLAY command to complete before triggering a timeout error.

String = objKantu.getLastError()

Returns the error text of the last error that occurred. Typically this command is used after the Play command if the return value is < 0 (which indicates an error)

String = objKantu.GetExtractImageData()

Returns the extracted information as string

objKantu.Close

Closes the Kantu Browser.

More Commands

These commands are for expert use and typically used if you need a deeper integration between your application and Kantu.

i = objKantu.searchImage(image, 0.38)

Runs an image search on the currently open browser window.

Top

And if your question is not answered here,...

...please contact us. We love to hear from you!

Top
Follow a9t9 on Twitter
Contact Us
Download Kantu Freeware
Copyfish for Chrome/Firefox
Subscribe to the a9t9 automation software newsletter . We'll send you updates on new releases that we're working on.