asp.nettestingwatintabcontainer

How do you use WatiN to click on an Ajax toolkit TabContainer header?


I have an ajax toolkit TabContainer control on my page with a couple tabs. In my test, I would like to switch between the tabs.

I've tried _ie.Span("tabHeaderID").Click(), .MouseDown(), .FireEvent("onclick"). I've tried these same methods on the parent span elements as well.

I've also tried Eval-ing some javascript to set the active index like so:

_ie.Eval("$get(\"ctl00_AdminContentPlaceHolder_TabContainer1\").set_activeTabIndex(1);");

Has anyone successfully used WatiN to switch tabs?


Solution

  • I have not figured out how to simulate a click on the tab header. However, I do have a way to get to the second tab - just a small variation on the eval statement from my original post:

    _ie.Eval("$find(\"ctl00_AdminContentPlaceHolder_TabContainer1\").set_activeTabIndex(1);");

    It uses $find instead of $get to get the tab container object.