Integración de la tecnología de Aplicación SIKULIX-SCHEDULER

ServicePilot application-sikulix-scheduler

# SikuliX Scheduler


This package is designed to upload and schedule and run SikuliX scenarios under Windows.


This package uses the ServicePilot Agent to upload a ZIP file containing a number of SikuliX scenarios. A Windows PowerShell script is then called to unpack this ZIP file and create a Windows task that will run the SikuliX scenarios in sequence.

For each scenario run, another ServicePilot resource will be needed to receive the data of the run.

WARNING: Only one application-sikulix-scheduler resource can be added by Windows computer on which a ServicePilot Agent is installed. Multiple scenarios can be run by the same scheduler but these must be run in sequence as SikuliX makes use of the Windows Desktop.

NOTE: A Windows user needs to be logged in to a Desktop on the Windows computer on which the SikuliX scenarios are to be run. This Desktop needs to be available at all times for the SukuliX scenarios run so make certain that a Windows console Desktop is open, set to never lock and that the computer will not sleep or suspend.

WARNING: Each scenario will need to tidy up after itself, even in case of failure, or subsequent scenarios will need to clean the environment so that they may produce reproducible results. For example if a web browser is used, it should probably be opened when the scenario is started and closed when the scenario ends.


  • Network Flows - It is necessary to ensure network connectivity between the ServicePilot Agent that will schedule the SikuliX scenarios and the ServicePilot Manager. In case of a network infrastructure with a firewall, the following flows must be opened:

    • ServicePilot Manager Web server access (by default TCP/80 when using HTTP or TCP/443 when using HTTPS although this port is configurable): Between ServicePilot Agent and ServicePilot Manager
  • Java Runtime Environement - SikuliX requires Java to run. Install JRE 8 on the Windows machine on which the scenarios are to be run.

  • SikuliX - SikuliX needs to be installed on the Windows machine on which the scenarios are to be run. ServicePilot recommends that this be installed in C:\ServicePilot\SikuliX.

  • SikuliX Scheduler scripts and resources - This package requires 3 files to be placed where SikuliX is installed. The content of these files can be cut and paste from the documentation below:

    • application-sikulix-scheduler.ps1 - A PowerShell script that will be called by the ServicePilot Agent to schedule the SikuliX scenarios.
    • ServicePilotSikuliXTask.xml - A Windows scheduled task template used to run the SikuliX scenarios.
    • run-sikulix-scenarios.ps1 - The PowerShell script called by the scheduled task that will run the SikuliX scenarios.
  • ServicePilot Requirements

    • ServicePilot Manager minimum version: 9.0
    • ServicePilot Agent minimum version: 9.0 installed and configured


Before adding a resource to monitor, make certain that all pre-requisites are in place and that ServicePilot Agent is communicating correctly with the ServicePilot Manager. Resources can be added to ServicePilot configuration using Views Configuration web interface

  1. As an administrative user of ServicePilot, open the ServicePilot web interface.
  2. Navigate to Administration. The Configuration > Views web page will open.
  3. Click on the view in which to place the new resource in the Views hierarchy on the left of the interface. The View editor section will show the existing view contents.
  4. From the Packages list on the right of the interface, click and drag the application-sikulix-scheduler package into the View editor and let go.
  5. The Resource properties dialog box will open to allow resource configuration.
  6. Click OK to close the Resource properties dialog box. Note that the dialog box will not close if required parameters are not set.
  7. Click Save to apply the new resource to ServicePilot configuration.
  8. Check in the ServicePilot Agent logs and the Windows Task Scheduler to see if the task has been correclty added.


Object TypeLicense object ConsumedCondition

Key field notes

  1. Parameters tab:

    1. Directory: The SikuliX directory in which application-sikulix-scheduler.ps1, ServicePilotSikuliXTask.xml, run-sikulix-scenarios.ps1 and runsikulix.cmd have been placed.
    2. Scenarios ZIP file: A ZIP file containing *.skl and *.sikuli scenarios to run. This file will be uploaded from the RemoteCommandAgent directory in the Conf directory of the ServicePilot Manager to the Agent host that will run the SikuliX scenarios. If scenarios are changed or added, rename this file. If scenarios are to be stopped, set this to a non-existant file name but not blank.
    3. Domain: The Windows domain or hostname of the user that will log-in and run the SikuliX scripts.
    4. User: The Windows userid of the user that will log-in and run the SikuliX scripts.
  2. Frequency tab:

    1. Login Delay: Wait this many minutes after the user logs in to the system before running the scenarios.
    2. Execution Frequency: The interval between the start times of the scenarios run in minutes.
    3. Execution Limit: The maximum time that a scenario run should take in minutes before it is terminated. This should be less than the Execution Frequency.


See the application-sikulix-scenario package that can be used to receive data from a SikuliX scenario.

The content of the application-sikulix-scheduler.ps1 file to be placed on in the SikuliX directory on the Windows machine that will run the SikuliX scripts:

param ( [Parameter(Mandatory=$True)] [ValidateNotNullorEmpty()] [string]$dir, [Parameter(Mandatory=$True)] [ValidateNotNullorEmpty()] [string]$scenarios, [Parameter(Mandatory=$True)] [ValidateNotNullorEmpty()] [string]$domain, [Parameter(Mandatory=$True)] [ValidateNotNullorEmpty()] [string]$user, [Parameter(Mandatory=$True)] [ValidateRange(1,15)] [int]$delay, [Parameter(Mandatory=$True)] [ValidateRange(1,1439)] [int]$interval, [Parameter(Mandatory=$True)] [ValidateRange(1,1438)] [int]$limit)if (-Not(Test-Path -Path "$dir\$scenarios.running")) {   Get-ChildItem -Path "$dir" -File -Filter "*.running" | Select-Object -Property FullName | ForEach-Object {       $scenarioZip = $_.FullName.Substring(0,$_.FullName.Length-8)       Remove-Item -Path $scenarioZip -Force -ErrorAction Ignore       Remove-Item -Path $_.FullName -Force -ErrorAction Ignore   }   $delayval='PT'+ $delay + 'M'   $intervalval='PT' + $interval + 'M'   $limitval='PT' + $limit + 'M'   $xmlfile = 'ServicePilotSikuliXTask.xml'   & 'SCHTASKS' '/End' '/TN' 'ServicePilotSikuliXTask'   & 'SCHTASKS' '/Delete' '/F' '/TN' 'ServicePilotSikuliXTask'   Set-Location $dir   Remove-Item "$dir\scenarios" -Force -Recurse -ErrorAction Ignore   if (Test-Path -Path "$dir\$scenarios") {       Add-Type -assembly ""       [io.compression.zipfile]::ExtractToDirectory("$dir\$scenarios", "$dir\scenarios")       $xml = [xml](Get-Content $xmlfile)       $xml.Task.RegistrationInfo.Author = [string]$user       $xml.Task.Triggers.LogonTrigger.Repetition.Interval = [string]$intervalval       $xml.Task.Triggers.LogonTrigger.ExecutionTimeLimit = [string]$limitval       $xml.Task.Triggers.LogonTrigger.UserId = [string]$user       $xml.Task.Triggers.LogonTrigger.Delay = [string]$delayval       $xml.Task.Principals.Principal.UserId = [string]$user       $xml.Task.Settings.ExecutionTimeLimit = [string]$limitval       $xml.Task.Actions.Exec.WorkingDirectory = [string]$dir       $xml.Save($xmlfile)       & 'SCHTASKS' '/Create' '/TN' 'ServicePilotSikuliXTask' '/XML' 'ServicePilotSikuliXTask.xml'       & 'SCHTASKS' '/Run' '/I' '/TN' 'ServicePilotSikuliXTask'       New-Item -ItemType File -Path "$dir\$scenarios.running"   }}

The content of the ServicePilotSikuliXTask.xml file to be placed on in the SikuliX directory on the Windows machine that will run the SikuliX scripts:

<?xml version="1.0" encoding="UTF-16"?><Task version="1.2" xmlns=""> <RegistrationInfo>   <Date>2018-04-06T16:29:25.2720295</Date>   <Author>Admin</Author>   <Description>Repeatedly runs SikuliX scenarios from ServicePilot SikuliX scenario directory in sequence</Description> </RegistrationInfo> <Triggers>   <LogonTrigger>     <Repetition>       <Interval>PT60M</Interval>       <StopAtDurationEnd>false</StopAtDurationEnd>     </Repetition>     <ExecutionTimeLimit>PT59M</ExecutionTimeLimit>     <Enabled>true</Enabled>     <UserId>Admin</UserId>     <Delay>PT5M</Delay>   </LogonTrigger> </Triggers> <Principals>   <Principal id="Author">     <UserId>Admin</UserId>     <LogonType>InteractiveToken</LogonType>     <RunLevel>LeastPrivilege</RunLevel>   </Principal> </Principals> <Settings>   <MultipleInstancesPolicy>StopExisting</MultipleInstancesPolicy>   <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>   <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>   <AllowHardTerminate>true</AllowHardTerminate>   <StartWhenAvailable>true</StartWhenAvailable>   <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>   <IdleSettings>     <StopOnIdleEnd>true</StopOnIdleEnd>     <RestartOnIdle>false</RestartOnIdle>   </IdleSettings>   <AllowStartOnDemand>true</AllowStartOnDemand>   <Enabled>true</Enabled>   <Hidden>true</Hidden>   <RunOnlyIfIdle>false</RunOnlyIfIdle>   <WakeToRun>false</WakeToRun>   <ExecutionTimeLimit>PT59M</ExecutionTimeLimit>   <Priority>7</Priority> </Settings> <Actions Context="Author">   <Exec>     <Command>powershell</Command>     <Arguments>-ExecutionPolicy Bypass -WindowStyle Hidden -NoLogo -File "run-sikulix-scenarios.ps1"</Arguments>     <WorkingDirectory>C:\ServicePilot\SikuliX</WorkingDirectory>   </Exec> </Actions></Task>

The content of the run-sikulix-scenarios.ps1 file to be placed on in the SikuliX directory on the Windows machine that will run the SikuliX scripts:

Get-ChildItem -Path '.\scenarios' -Filter *.sikuli | Foreach-Object {   $scenario = $_.Name   & '.\runsikulix.cmd' '-r' "scenarios\$scenario"}Get-ChildItem -Path '.\scenarios' -Filter *.skl | Foreach-Object {   $scenario = $_.Name   & '.\runsikulix.cmd' '-r' "scenarios\$scenario"}

Cómo podemos ayudarle ?

O llámenos a +33 2 40 60 13 30