SikuliX Template Script
The following template can be use as a base to develop a new project. It contains a timer for the total project time and one try/except block which stands for one step of a use case. It is recommended to create a separate try/except block for each step timer.
#######################################
## Basic SKOOR / SikuliX Template ##
## Version 1.0 ##
#######################################
from skoor import SkoorUtils
from skoor import SkoorTimer
from skoor import SkoorScreenshot
# Prepare App class instance for application
app = App("app.exe")
# Prepare SKOOR timers
totalTime = SkoorTimer("TotalTime")
timer1 = SkoorTimer("Timer1")
totalTime.start()
try:
timer1.start()
app.open()
appWindow = App.focus("Window title")
<code>
appWindow.close()
timer1.stop()
except BaseException, e:
Debug.error(str(e))
timer1.error(-2, "Step failed")
SkoorScreenshot.capture()
totalTime.stop()
Actions on application windows
To perform actions on application windows such as focus, minimize, maximize or close, the title should be used as a key to find the correct window.
If the title is known, it can be used as parameter of the App.focus() function:
app = App("app.exe")
app.open()
appWindow = App.focus("Window title")
If the title is not known, it can be evaluated:
app = App("app.exe")
app.open()
appWindow = App.focus(App("app.exe").getTitle())
The appWindow variable can then be used for window actions (see SikuliX help for further information on the App class and its functions):
appWindow.minimize() ... appWindow.restore() ... appWindow.close()