I'll start moving some of the questions that we have gotten from our blog and code plex over to the forum so that they are easier to search.
Q: I'm having trouble finding a way to look at a ValidationSummary server side conrtol to see the errors that were added. I can find the control using HtmlPage.Elements.Find("") but how do I see the text/html?
A: Here is a sample test to verify the text of the validatiosummary:
HtmlPage p = new HtmlPage("Login.aspx");
p.Elements.Find("Button1").Click();
string errorMessages = p.Elements.Find("ValidationSummary1").GetInnerTextRecursively();
Assert.StringContains(errorMessages, "Name is Required");
Assert.StringContains(errorMessages, "Password is Required");
farmas
Participant
1164 Points
259 Posts
Microsoft
How to get the text rendered by ValidationSummary control?
Feb 13, 2009 02:19 AM|LINK
I'll start moving some of the questions that we have gotten from our blog and code plex over to the forum so that they are easier to search.
Q: I'm having trouble finding a way to look at a ValidationSummary server side conrtol to see the errors that were added. I can find the control using HtmlPage.Elements.Find("") but how do I see the text/html?
A: Here is a sample test to verify the text of the validatiosummary:
HtmlPage p = new HtmlPage("Login.aspx"); p.Elements.Find("Button1").Click(); string errorMessages = p.Elements.Find("ValidationSummary1").GetInnerTextRecursively(); Assert.StringContains(errorMessages, "Name is Required"); Assert.StringContains(errorMessages, "Password is Required");- Federico