I am trying to inspect a text on a page and when I inspect it, I see this:
< div class="welcome-message">
< h1 data-bind="text: $.t('wfo.Common:wfo.Welcome'), attr: { title: $.t('wfo.Common:wfo.Welcome') }" title="Welcome">Welcome</h1>
In my code , I am using the Xpath to find the element, then trying to verify this
Assert.IsTrue(AdminPage.IsAt, "Not In Admin Page");
by implementing below code:
public static bool IsAt {
get{
var h3 = Driver.instance.FindElements(By.XPath("//div[@class='welcome-message']/h1[@title='Welcome']"));
if (h3.Count >0)
return true;
return false;
}
}
But when I run the case, I am getting the failure: The "Not In Admin Page" Error message is seen.
What I am trying to do is to return a list of IwebElements per the searching criteria, and a true response should be returned when the element is found, Until now, I am assuming that I want to match the "True" criteria. I am new in Selenium, your help on this will be highly appreciated, thanks a lot.