Automatize UI actions or perform UI test automation with SiculiX

If you need to automate some GUI action for elude the timeout of some application or you want to do generic UI test automation your tool is SiculiX.

Auto scroll on Jupyter Notebook Browser page

This library can be used for test automation of UI application in each operative system that support Java, so it can be used on Linux, FreeBSD, Windows and OSX.

I will explain a very very easy use case, just to introduce and get started with some potentiality of SiculiX.

Some useful thing to do for elude a timeout of an app that check if you are watching it we can create a script that scroll up and down the mouse, and ask you some times to do this action, so we can do other works and sometimes it remember us to watch the app and if we are not on the PC continue to scroll automatically.

This code can be found at this repo.

You must install the following:

  • Java: vm to exec .jar executable
  • SiculiX : the IDE and engine

Run SikuliX with double click on the .jar file or by command line with:

java -jar sikulixide-2.0.5.jar
# or specify the path of your java if you have multiple
/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java -jar sikulixide-2.0.5.jar
SIkuliX IDE

Now write and save the code

popup_timeout = 3
popup_message = "Did you want to continue to scroll? (after 3 second without response it )"
popup_title = "Scroll for timeout"

after_popup_delay = 2
next_popup_delay = 2

while(True):
answer = Do.popAsk(popup_message, popup_title, popup_timeout)
if not answer and answer != None:
exit(1)

sleep(after_popup_delay)

wheel(Mouse.WHEEL_DOWN, 5)
wheel(Mouse.WHEEL_UP, 5)

sleep(next_popup_delay)

Click on run button on top right and see the results.

The base language of SiculiX is python so the syntax is

This code use Do.popAsk to create a popup with yes or no choices, temporized: after a time return None and close it.

So we exit the program only if the answer is No (that value false) and not is None (that is a synonym of false).

After we move the mouse wheel of 5 pixels wheel(Mouse.WHEEL_DOWN, 5), wheel(Mouse.WHEEL_UP, 5).

The sleep instruction simply wait some seconds.

The commands of SiculiX are more than this, it can type, or click on something using coordinates or using a reference image and more, for more learning you can watch this 5 youtube tutorial.

SiculiX is a very powerful tool and it can also be combined with RobotFramework and Selenium. This is a simple example, but remember when you write your automated test that you need an assert after do a particular action to “assert” that the program work correctly and not only that it does not crash. This assert can be done with simple if and raise exceptions or using the power of RobotFramework.

Enjoy your automation and test your works!

Linux user and Open Source fun. Deep learning PhD Student, Full stack web developer, Mobile developer