Basic use for multiple platforms/browsers

Asked by Roger F Borrello Jr

Hi. I have looked over some questions/answers like to determine if our usage of capturing testcases on one environment, and running them on another is even possible. It sounds like image captures will need to be specific to the system under test. In other words, captured Windows Chrome images should only be used on Windows Chrome tests. If we run the same tests on Ubuntu Chrome, they will need to use Ubuntu Chrome images to validate the functions.

If my above assumption is correct, what about utilizing more text-based comparisons? Given that we would know what text should appear in certain regions, I would expect that we could achieve a level of independence. But I am not seeing consistent results when I attempt this, and I am trying to determine what is at fault. Maybe I am choosing a region and the location of the browser on the target may be offset somewhat, so the same text is not found?

I am a beginner at this, and would like to know more about why text is not found, so I can make corrections and improvements.

Question information

English Edit question
SikuliX Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :

--- same image in other environments
The image search used in SikuliX is based on pixel content. An image can only be found at all, if width and height in pixels of the sample image is the same as it is shown at time of search on the screen.
The more pixels differ, the lower the match score. The lower the match score, the higher the risk for false positives.
Differences in pixel content in different environments are mainly produced by differences in the rendering behavior (how is a given graphic element shown on screen).
To minimize all the risks (besides taking care for same size) is to concentrate the snapshot on the key elements of the image, that makes it unique on the current screen. Have as little surrounding background (< 10-20%).
If you have the need to run your stuff in different environments, be prepared, to have different image sets (ImagePath feature, naming convention, re-capture on the fly, ...)

--- using text based on OCR
... is surely something you can use additionally in special situations.
But as an overall replacement for image search in my experience it is not really useable.
In the end it also has many quirks, that you have to accept or have to implement solutions/workarounds.

Revision history for this message
Roger F Borrello Jr (mydoll) said :

Thank you for that information. It was helpful. I have some small follow-ups, due to your recommendation to create repositories for the testcase screen captures as the best method for handling our requirements.

If our tests execute a query that returns data in a table, best practice would be to start from a known set of data for the testcases, so that we have predicted results. How would you recommend that we handle an area of data that is specific to the time frame by which the test is executed (like a current timestamp)? Is there a way to exclude an area of a region?

If our test scenarios consist mostly of execution of browser interactions, we'd want to determine at runtime which browser we are executing on so that we can collect the proper image set. The use of Settings.getOS() is easy enough for the OS. But by what method would you recommend determining the browser?

Revision history for this message
RaiMan (raimund-hocke) said :

--- Is there a way to exclude an area of a region?
A Region is the area on the screen, where a given image is searched in.
It is always a regular rectangle.
If you mean, that the given image to search for, has a part, that should be ignored, because it varies, then you can try with the transparency feature (transparent parts of the image are ignored): (topic masking).

--- determining the browser
... is not possible with SikuliX, since SikuliX does not know anything about the application it is acting on (only pixels on the screen).

You have to use something, that runs in the browser and creates something you can detect with SikuliX (Javascript, ...).
search the net for possible solutions.
... or ask your developers ;-)

Can you help with this problem?

Provide an answer of your own, or ask Roger F Borrello Jr for more information if necessary.

To post a message you must log in.