Page 1 of 1

Validating Two or more elements

Posted: Tue Aug 14, 2012 5:59 pm
by regex
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));
}

else
{
Validate.NotExists(repo.Worklist.QAReportsInfo);
}
}

Tries:

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

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

Re: Validating Two or more elements

Posted: Thu Aug 16, 2012 10:27 am
by Support Team
Hello,

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!

Ragards,
Bernhard
Ranorex Support Team