Kantu - Documentation
As the first step after installing Kantu we suggest that you run some or all of the included demo scripts. This will give you a good feeling of what Kantu can do.
To create your own image scripts, click the "tape icon" and the image wizard appears. It helps you to take the screenshots for your script.
- 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+Type(for sending text to input boxes) . For web testing, there is also
- Click "Add" to record the screenshot and command
Findto assert a certain image is on the screen.
- When you are done with recording, click stop.
- Save the script under a new name.
- Select Play to run your script.
- 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
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.
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 dozends of websites and it worked with all. If you come across any that does not work, contact us.)
Command Line Options
You can run Kantu from the command line/batch file:
Kantu.exe script.xkts=> opens Kantu and runs script.xkt. Kantu stays open after the script is completed.
Kantu.exe script.xkts -ae=> opens Kantu, runs script.xkts, and then closes Kantu (ae = and exit). This is the recommended syntax if you start Kantu from a task scheduler.
Kantueditor.exe script.xkts=> opens script.xkts in the Kantu Editor
Use the Kantu Browser Scripting API
For more complex automation, there is the Kantu Browser API. It can be used from any programmig or scripting language. Some VBS and Powershell sample scripts are included. As a start, run them to see what the API can do.
open you launch Kantu instances, and with
play you run the image scripts. 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.
- Browser Scripting API
Example codeon GitHub:
- - Batch File (Kantu command line)
- - C# (Visual Studio Project)
- - Powershell
- - VBS (Visual Basic Scripting)
- See also the FAQ: How to create IF THEN ELSE statements with Kantu?.
- Kantu also works with any other programming or scripting language. Contact us if you need some help getting started.
Kantu - FAQs
What if the UI object I am clicking on moves 2 pixels over?
Kantu works like a human. It looks for the image everywhere on the screen. As long as the image is anywhere on the page, it will be found. By default (and for performance reasons) Kantu looks on the visible part of the screen only (= what you see in your browser screen). You can add the SearchImageInWholePage parameter to make it search the whole website.Top
Will the scripts break if there is adaptive layout on the website?
(1) If, as in most cases, all the adaptive layout does is to move the buttons/images to a different place, then all works fine. Kantu will find the image anywhere on the screen.
(2) But if a button (or whatever image you look for) drastically changes its size or even disappears, then yes, the script would be break. Example: If a navigation menu collapses to the ☰ symbol, this will break the script.
What about smart waiting?...so if I click the "login" button and then it takes 1 to 5 seconds to get to the next page, does this framework have intelligent waits? or does it rely on something like "Thread.Sleep(5000)"?
Kantu supports smart waiting. Essentially it looks for the image non-stop and does not continue until the image is found. Pretty much like a human user. By default it waits up to 10 seconds. You can adjust this timeout to any value, either globally for all scripts or for a specific command. For example, you will need to extend this value when waiting for the result of a flight search on Expedia or for a longer file upload to complete. In all cases this is smart waiting, and not a hard-coded delay.Top
Can I use best practices like the "Page object model"?
... so that if I develop thousands of tests and then someone changes how the "login" screen works, I can simply update 1 object instead of updating 1000s of scripts?
For this we have the
API: You can split your image scripts in sub-tasks like "Login" or maybe "Upload Image"
and then mix & match those script with the
- Kantu.Play ("Login.xkts")
- Kantu.Play ("Upload image.xkts")
- Kantu.Play ("Logout.xkts")
Does Kantu support Flash testing?
Kantu works well with Flash and can even automate Flash games. You only need to install the Flash plugin.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 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?
Kantu separates the linear website flow logic (the screenshot script) and the programming/scripting logic (via the Scripting API). So for tasks like condidtional statements, use the Scripting Interface. 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 ("Script1")
if IntegerReturnValue = 1 then
'Do something else
IntegerReturnValue = objKantu.Play ("Script2")
This example uses the VBS/Visual Basic syntax, but you can use any programming or scripting language with the Scripting API.
Kantu - User Manual
Kantu is a new software and under active development. To keep the user manual fresh and allow users to comment on it, we use a public Google Doc for it. The following links lead you to the most important chapters:
And if your question is not answered here,...
...please contact us. We love to hear from you and often respond within minutes, but for sure within 24 hours.Top