Sikuli is able to automate anything you see on your computer screen by using image recognition to identify components you want to interact with. This is very useful if you want to test things that are not easy to automate, for example native OS GUI components.
Since Sikuli runs on Windows, Mac and Linux - it is extremely useful to use during your tests.
TestingBot now supports Sikuli on all VMs: Windows (XP, VISTA, 8, 10), Linux (Ubuntu) and OS-X (Mavericks, Yosemite, El Capitan, Sierra, High-Sierra, Mojave).
By supplying a sikuli
option in your desired capabilities, TestingBot will automatically download the Sikuli script you specified and run it at the start of your Selenium WebDriver test.
An example on how to automatically click a Chrome dialog button, allowing Chrome to install a Chrome extension:
This will wait for a button called "Add extension" to appear on the screen. Once it appears, Sikuli will click the button automatically. We have to use Sikuli for clicking this button since WebDriver is not able to do this.
Of course, you can use Sikuli to do other things as well: clicking the browser menu, save as bookmark, install a plugin, ...
Integration with TestingBot
At TestingBot, we can run your Sikuli script at the start of your Selenium WebDriver test.
Simply create a zip-file with one or more of your .sikuli
scripts inside. Then use that URL in your desired_capabilities when starting a test.
This way you can run Sikuli tests in the cloud on all our platforms.
An example:
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("platform", "VISTA");
caps.setCapability("version", "9");
caps.setCapability("browserName", "internet explorer");
caps.setCapability("sikuli", "http://mywebsite.com/sikuli-scripts.zip");
Example automatically add Chrome extension
Below is an example in Ruby on how to install a Chrome extension on our VMs at the start of your test, automatically.
require "rubygems"
require "selenium-webdriver"
require "selenium/client"
caps = {
:browserName => "chrome",
:platform => "CAPITAN",
:sikuli => "http://mywebsite.com/sikuli-example.zip"
}
urlhub = "http://hub.testingbot.com/wd/hub"
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 120
@webdriver = Selenium::WebDriver.for :remote, :url => urlhub, :desired_capabilities => caps, :http_client => client
@webdriver.navigate.to "https://chrome.google.com/webstore/detail/office-editing-for-docs-s/gbkeegbaiigmenfmjfclcdgdpimamgkj"
sleep 3
@webdriver.find_element(:css, '.webstore-test-button-label').click
sleep 20
# now wait for Sikuli to automatically click the button
@webdriver.quit