Skip to content
QiTASC.com / intaQt Built-ins /
Sikuli Built-ins
/ .. /
Sikuli Built-ins





Sikuli Built-Ins

Sikuli Built-ins integrate the Sikuli visual automation and testing tool with intaQt test cases. Sikuli uses image recognition to locate GUI elements captured in screenshots, which can then be managed and automated. Information about the functions below are available in the Sikuli documentation here.

Syntax

1
2
Sikuli.screen()
Sikuli.pattern(<imagePath String>)

Parameter

  • imagePath - The absolute path to the image

Example

1
imagetest := Sikuli.pattern("c://Users/MyAccount/MyImages/testimage.png")

Screen() Function

The screen() function provides a screen where the following functions can be called:

  • getcurrentID()

  • all()

  • as(int)

  • setAsScreenUnion()

  • setAsScreen()

  • initScreen(Screen)

  • getScreen()

  • showMonitors()

  • resetMonitors()

  • getNumberScreens()

  • getPrimaryId()

  • getPrimaryScreen()

  • getScreen(int)

  • getBounds()

  • getBounds(int)

  • getRobot(int)

  • getID()

  • getIdFromPoint(int, int)

  • getRobot()

  • newRegion(location, int, int)

  • getLastScreenImageFromScreen()

  • newLocation(location)

  • capture()

  • capture(int, int, int, int)

  • captureforHighlight(int, int, int, int)

  • saveCapture(String)

  • saveCapture(String, Region)

  • selectRegion()

  • selectRegion(String)

  • showTarget(Location)

  • toJSON()

Pattern() Function

The pattern() function can call the following functions:

  • isImagePattern

  • isValid

  • similar(float)

  • exact

  • getSimilar

  • targetOffset(int, int)

  • targetOffset(location)

  • getTargetOffset

  • setImage

  • getImage

  • setTimeAfter(int)

  • getTimeAfter

  • toString

Example Model

In the model below, the image paths have been replaced by context objects.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
model App

    func login(screen, username, password)
        screen.wait(img("Login"), 5.0)

        usernameLocation := Sikuli.pattern(img("LoginFields")).targetOffset(0, 40)
        clearAndType(screen, usernameLocation, username)

        passwordLocation := Sikuli.pattern(img("LoginFields")).targetOffset(0, 70)
        clearAndType(screen, passwordLocation, password)

        screen.click(img("LoginSignIn"))

        screen.wait(img("QuickNav"), 30.0)
    end

    func clearAndType(screen, pattern, text)
        screen.doubleClick(pattern)
        screen.type("a", Sikuli.keyModifier("CTRL"))
        screen.type(Sikuli.key("BACKSPACE"))
        screen.type(text)
    end

    func img(name)
        config := getExecutionContextObject("")
        return config.imgPath + name + ".png"
    end
end