tags:

views:

169

answers:

1

Hi All,

I m using Watir for automated testing a webapp.

In one of the page i have something like htis

</STYLE></HEAD><BODY background="IMAGES/fon06.gif"><DIV class="mainalignment" height="110%" width="110%"><TABLE class="mainframe" height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0"><TBODY><TR><TD><DIV id="divTabButtons"><P align="left"> <INPUT class="tabOff" id="1" onclick="tabOnClick(1)" type="button" value="TIMESHEET" /> </P></DIV></TD></TR></TBODY></TABLE></DIV></BODY></HTML>

But m able to identify the HTML element to access it. I need to access the id="1" value="TIMESHEET" element.

How do I do it in Watir.

If more info is required pls let me know. Note: I am a HTML noob.

EDIT: I tried showAllObjects to see whether the objects are displayed or not.

and this is what I got -----------Objects in page ------------- HTML Document name=header id= src=header.jsp HTML Document name=body id= src=body.jsp

This is very strange. but When i look at the page..there are many objects..

I m confused now..

+1  A: 

If you want to click the button, any of these will work:

browser.button(:id, "1").click
browser.button(:value, "TIMESHEET").click
browser.button(:id => "1", :value => "TIMESHEET").click

More information at http://wiki.openqa.org/display/WTR/Buttons and http://wiki.openqa.org/display/WTR/Multiple+Attributes

Željko Filipin