The known facts
1) I can cast an ObjectModel Element to HtmlControl -- element.As<HtmlControl>()
2) There is no option to find nested element through Object Model Element
3) There is option to find nested child through HtmlControl
4) Can find an element through by various HtmlFindExpression or FindExpression
5) Not all elements can be parsed as HtmlControl. Element Object Model is very useful for labels, paragraphs, etc.
We want to find a nested <label>,<p>,<h1>, <h2>, <h3>, <i>, etc.. Element Object is very handy.
6) Another feature of Element Object is the ability to detect and verify if we have got hold of the right element through property - element.Content or ParsedElement..... This feature is not available in HtmlControl
My requirement is
a) There are scenarios where you get complex nested structure generated dynamically. Only the Parent has an unique identity..
b) I want to have a generic API where we can use both HtmlControl & Element. This allows us with more flexibility to locate the exact element we are after in verification.
c) Have attached the sample file, along with the html and screen shot.
1) Find nested ObjectModel Element [ not HtmlControl ]
2) Cast HtmlControl to ObjectModel Element.