Search code examples
watin

How to treat Button as a container in WatiN?


<button> is a very well valid container in HTML standard yet WatiN DOM implementation does not support that behavior. Is there way to "cast" it to a container to query child elements of that button? My attempts to do it with ElementContainer<TElement> instances were in vain.


Solution

  • We worked this around by creating a descendant of ElementContainer<Button> naming it ContainerButton. We used that whenever we wanted to refer to a button. It needs to have an [ElementTag("button")] attribute at top.