Variable based image validation?

Ask general questions here.
Posts: 3
Joined: Wed Jun 12, 2019 7:06 pm

Variable based image validation?

Post by shawn1 » Fri Jul 12, 2019 4:22 pm

To summarize, I have to test cross-browser some reports for my project, and the reports show up with very subtle differences on each browser (the same report will have different spacings across all browsers). These subtle differences cause the automation to fail. I've done these things:

1) Do ContainImage validation => doesn't work, will fail
2) Do ContainImage validation with 0.99 similarity with report similarity off => takes 10+ minutes and is not viable

Is there a way to put variables within image validation. I'm not trying to get the repository item to be a variable, I'm trying to set variables for the actual screenshot it's verifying against. The reason I ask is that I'm trying to do this all in one recording.

There are two workarounds that I'm trying to avoid:
1) Do the comparison in code
2) Have three recordings instead of one

If it's not possible, that's fine. I just need to know that :)

User avatar
Ranorex Guru
Ranorex Guru
Posts: 6557
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Variable based image validation?

Post by odklizec » Mon Jul 15, 2019 12:20 pm


In my opinion, there is no way to add variables in image-related recording actions. It's possible via code, but if you want to avoid code, then I'm afraid, you are out of luck here?

BTW, are you sure the image-based validation is the best option for the scenario you described? Any chance you could post a Ranorex snapshot(s) of problematic elements (ideally saved in multiple browsers), along with detailed steps of what you want to achieve? I think that spacing problems during validation could be solved with regexes or something else? Almost anything is be better than image-based validation of web pages ;) Seriously!
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration