Are you curious how to deal with the complicated rendering of RadControls and WatiN? If so, I will shed some light on this.
Here is an example how to print the text of the specific node of RadTreeView and how to expand it:
| [STAThread] |
| static void Main(string[] args) |
| { |
| IE ie = new IE("http://demos.telerik.com/aspnet/prometheus/TreeView/Examples/Programming/DataBinding/DefaultCS.aspx"); |
| Element ulElement = ie.Element("UL", Find.ByClass("rtUL rtLines")); |
| Element firstLiElement = ulElement.DomContainer.Element("LI", Find.ByIndex(1)); |
| Span textSpanElement = (Span) firstLiElement.DomContainer.Div(Find.ByClass("rtTop")).DomContainer.Span(Find.ByClass("rtIn")); |
| Console.WriteLine(textSpanElement.Text); |
| Span plusSpanElement = (Span)textSpanElement.PreviousSibling; |
| plusSpanElement.Click(); |
| } |
Yet another example how to click on a child item of RadMenu(you have to open its parent first):
| [STAThread] |
| static void Main(string[] args) |
| { |
| IE ie = new IE("http://demos.telerik.com/aspnet/prometheus/Menu/Examples/Programming/AddRemoveDisableItems/DefaultCS.aspx"); |
| Element item1LiElement = ie.Element("li", Find.ByClass("rmItem rmFirst")); |
| item1LiElement.FireEvent("onmouseover"); |
| ie.Span(Find.ByText("Text File")).WaitUntilExists(); |
| Span childMenuItem = ie.Span(Find.ByText("XML File")); |
| childMenuItem.Click(); |
| } |
This example shows how to access the particular appointment of RadScheduler and how to open the advanced form:
| [STAThread] |
| static void Main(string[] args) |
| { |
| IE ie = new IE("http://demos.telerik.com/aspnet/prometheus/Scheduler/Examples/Default/DefaultCS.aspx"); |
| Element scrollContent = ie.Element("div", Find.ByClass("rsContent rsScrollingContent rsDayView")); |
| Element contentTable = scrollContent.DomContainer.Element(Find.ByClass("rsContentTable")); |
| Element appDiv = contentTable.DomContainer.Element("RadScheduler1_10_0"); |
| Console.WriteLine(appDiv.Title); |
| appDiv.DoubleClick(); |
| } |
Elena, Telerik