Image error observed while trying to use Sikuli with JRuby and Cucumber

141 views Asked by At

I am new to Sikuli. I am trying to setup an automated test suite using Sikuli and Cucumber.

Below is my step definition:

When(/^I click on DLM icon in the dock$/) do
  puts "Init"
  puts "Setting up screen"
  @screen=Sikuli::Screen.new
  puts "Going to click..."
  @screen.click("/Users/shrivaw1/Documents/Anshul/Testing/DLM/Automation/cucumber/features/images/dlm-ico.png")         # click the DLM icon
end

When I run the code I always get the below error:

The image '/Users/shrivaw1/Documents/Anshul/Testing/DLM/Automation/cucumber/features/images/dlm-ico.png' did not match in this region. (Sikuli::ImageNotFound)
  ./features/step_definitions/dlm.rb:16:in `/^I click on DLM icon in the dock$/'
  features/feature_files/dlm.feature:7:in `When I click on DLM icon in the dock'

It says the image did not match in this region. (Sikuli::ImageNotFound).

I tried this with many different images but same error is observed. Even though the image is there is the region. Surely I am missing something here. Can anyone please help me get this issue resolved? If anyone has created automation framework using Sikuli and Cucumber, please share your experience and some best practices. Thanks in advance.

2

There are 2 answers

0
Anshul On BEST ANSWER

Apparently, the issue was with Mac default screen capture tool (Cmd + Shift + 4). The screen shots taken were too large to be recognised in the screen. When I resized the images to 50%, it worked correctly.

Thanks to Eugene S for your answer though.

Thanks, Anshul

0
Eugene S On

That error means that Sikuli can't find the image you are using as a pattern on your disk. Make sure that it certainly exists in your specified path or as an even better solution, use bundlePath variable. You can read about it here: