Using html Table Snapshot for table element validation

Best practices, code snippets for common functionality, examples, and guidelines.
Posts: 6
Joined: Fri Mar 25, 2022 9:00 pm

Using html Table Snapshot for table element validation

Post by bthompson » Fri Mar 25, 2022 9:14 pm

Good Afternoon,

I'm new to the platform and I'm looking for some help with regards to using a snapshot for html table validations.
With two questions, I ask in the following code excerpt taken from the examples page, is it just as simple as listing the file name as a parameter, where string is set to 'filename_ReferenceTableSnapshot'?

Code: Select all

public void Validate_WebTableContentEqual(Ranorex.Adapter repoItem, string filename_ReferenceTableSnapshot, string customLogMessageOverall, string customLogMessageDetail) 
 // check if snapshot file exists 
 Ranorex.Validate.IsTrue (System.IO.File.Exists (filename_ReferenceTableSnapshot), string.Format("Checking existence of snapshot file: {0}",filename_ReferenceTableSnapshot )); 
 ElementSnapshot snap; 
 snap = Ranorex.Core.ElementSnapshot.CreateFromFile (filename_ReferenceTableSnapshot); // ElementSnapshot.CreateFromFile is available starting with Ranorex 5.4.2 
 throw new Ranorex.ValidationException ("Snapshot could not be loaded from file"); 
Secondly, since this projected is rooted in a work directory and the Snapshots folder exists in the root folder of Ranorex, is it possible to move this folder into my work repo without breaking the pathing?

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

Re: Using html Table Snapshot for table element validation

Post by odklizec » Tue Mar 29, 2022 9:06 am

Duplicated post. Already answered here: ... tml#p70158
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