Upload
happydev
View
250
Download
4
Embed Size (px)
Citation preview
Веселые картинки
Тестируем с помощью SikuliX
Как устроено SikuliX
SikuliX IDE
SikuliX IDE
Пример кода
Основные классы
• App• Region• Screen• Offset• Math• Similarity• Pattern
App
• App – используется для управления приложением• myApp = App("Firefox")• if not myApp.window(): • App.open("c:\\Program Files\\Mozilla Firefox\\
Firefox.exe")• wait(2)• myApp.focus()• wait(1)• type("l", KEY_CTRL) # switch to address field
Screen
Screen – охватывает весь экранcapture([region | rectangle | text])capture(x, y, w, h)selectRegion([text])
find()exist()wait()
Region
• Region – заданная область на экране. И это базовый элемент в концепции Sikuli.
• A Region does not know anything about it’s visual content (windows, pictures, graphics, text, ...). It only knows the position on the screen and its dimension.
• find()• exist()• wait()
Region
Region
• Basic attributes:• x, y, width, height; • Math is a Region;• Screen is also Region;• Chained methods• Screen(0).find(W).click(x).
Region
• find, findAll, exist, wait, waitWanish;• Mouse Actions:• click, doubleClick, rightClick, hover, dragDrop;• mouseDown, mouseUp;• Keyboard Actions:• type(text), paste(text);• keyDown, keyUp.
Match
• An object of class Match represents the result of a successful find operation. It has the rectangle dimension of the image, that was used to search. It knows the point of its upper left corner on an existing monitor, where it was found.
• Since class Match extends class Region, all methods of class Region can be used with a match object.
• match = region.find( or “text pattern”)
Pattern
• A pattern is used, to associate an image file with additional attributes used in find operations and when acting on a match object.
• similar(similarity)• exact()• targetOffset(dx, dy)