Validating Two or more elements

Ask general questions here.
Posts: 48
Joined: Tue Aug 14, 2012 5:47 pm

Validating Two or more elements

Post by regex » Tue Aug 14, 2012 5:59 pm

I am using an if/else statement to validate the existence of two unique objects within a webpage. The code is available below. I'd like to validate the association of two objects. I'd like to search the main page element or even the embedded LOGGEDIN element for "admin" using a regular expression. I cannot seem to get the syntax correct. I also get object reference does not exist when using if (repo.Worklist.QAReportsInfo.Exists() && repo.Worklist.loggedin.InnerText.Contains("admin") )

Any ideas?

public void verifyTabs()

if (repo.Worklist.QAReportsInfo.Exists() && repo.Worklist.loggedin.Title.Contains("admin") )
Report.Log(ReportLevel.Info, "Validation", "Admin Reports tab is displaying properly", repo.Worklist.QAReportsInfo, new RecordItemIndex(1));



if (repo.Worklist.QAReportsInfo.Exists() && repo.Worklist.loggedin.InnerText.Contains("admin") )

Validate.Attribute(repo.Worklist.loggedinInfo, "Text", new Regex("admin"));

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: Validating Two or more elements

Post by Support Team » Thu Aug 16, 2012 10:27 am


Are you sure that the attributes you want to verify are existing?
You can use Ranorex Spy to check if the attributes on your web page are available.
Please try to validate the repository elements separately to look which element has no reference.
Please send us a Ranorex snapshot file to analyze the issue.
Thank you!

Ranorex Support Team