How can I have watir recognize an input tag with a custom class?
In our application we have some input tags with the following attrbutes:
<INPUT class=input-time id=Projects-Projects_Project_0_Task_0_EntryHours_0>
I have tried most of the watir input methods but nothing works to recognize this objec开发者_如何转开发t. Can anyone shed a little light for me?
My watir version is 1.6.5.
Summary page at Watir wiki links to a few pages with a lot of useful data. Take a look at How and What, HTML Elements Supported by Watir and Ways Available To Identify HTML Element.
Examples (tested on Mac OS 10.6 with firewatir 1.6.6.rc1):
browser.text_field(:id => "Projects-Projects_Project_0_Task_0_EntryHours_0").set "test"
browser.text_field(:id => /Project_0/).set "test"
browser.text_field(:class => "input-time").set "test"
browser.text_field(:id => /Project_0/).set "test"
If the above code is not working then please try
browser.text_field(:id => /Project_0/).value="test"
Thanks Raveendran P
browser.text_field(:id => /EntryHours/i).set "test"
精彩评论