Assertion
From previous example we can validate the 4th “P” inner text using assertion.
HtmlControl Sample = new HtmlControl(Browser);
Sample.SearchProperties[HtmlControl.PropertyNames.TagName] = "p";
UITestControlCollection col = AllPtag.FindMatchingControls();
string p4 = col[3].GetProperty("InnerText").ToString();
Assert.AreEqual("Sample by - Tanmay Sarkar", p4, "Footer value is not equal");
And the output will be –
if we change the expected string on assert to see the error result like –
Assert.AreEqual("Wrong expectation", p4, "Footer value is not equal");
Then the output will be –
