开发者

help with Watir for automated testing a webapp

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&开发者_开发知识库gt;<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..


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


If you want to check first, you can do this:

if browser.button(:id, "1").exists?
   browser.button(:id, "1").click
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜