Testing tags not supported by Watir
Watir supports most HTML tags, and we use them to drive the testing:
link(:text, "some text").click td(:id, "special_cell").click
How to test tag (such as TH) which are not supported by Watir? You can use xpath to identify the element. Let me illustrate with an example: a tester wants to click the table heading 'LOGIN' on the page below:
It's source:
<th abbr="Login" scope="col">Login</th>It does not even have a ID! We could use the xpath to find the element: tag is 'TH' and attribute 'abbr' is 'Login'. Here is the test script:
ie.element_by_xpath("//th[@abbr='Login']").clickTo verify the solution, I modified the source to show a JavaScript popup window on clicking this table heading. And out test script worked: