Without x-path (yes please! it's so much easier to read this way)
b.frame.button(:id => 'button3').click
b.frame.button(:id => 'btnSubmitCopyPaste').click
On Friday, March 23, 2012 7:01:52 AM UTC-7, Hal Casteel wrote:
>
>
> ==========================
> HTML of my form: the relevant part - (html is inside an iframe)
> ==========================
>
>
>
> <td width="128">
> <label>
> <input type="button" title="Clear Form"
> onClick="document.getElementById('secondForm').value = '';"
> value="Clear Form" id="button3" class="cyp_btn_bg" name="button3">
> </label>
> </td>
>
> <td width="128">
> <label>
> <input type="button" onClick="AddToCart('11747')" value="Add to Cart"
> title="Add to Cart" class="cyp_btn_bg" id="btnSubmitCopyPaste">
> </label>
> </td>
>
>
> ====================
> Working ruby WATiR code
> ====================
>
>
> b.frame.input(:xpath => "//input[@id='button3']").click
>
> b.frame.input(:xpath => "//input[@id='btnSubmitCopyPaste']").click
>
>
>
> Note: My initial errors were do to the fact I did not not notice that
> the HTML was inside an iframe.
>
>
> After adding the frame the above code worked correctly.
>
> ========
> Question:
> ========
>
> Is there a way to do what I did above without using the XPATH method??
>
> Thanks
> On Mar 21, 3:34 pm, Željko Filipin <[email protected]> wrote:
> > On Wed, Mar 21, 2012 at 1:22 PM, Hal Casteel <
> [email protected]>
> > wrote:
> >
> > > Watir::Exception::UnknownObjectException: unable to locate element,
> > > using {:id=>"secondForm", :tag_name=>"input or textarea", :type=>"(any
> > > text type)"}
> >
> > The error message says Watir could not find the element. Are you sure
> > element is there? Are you sure the script is at the right page?
> >
> > Željko
> > --
> > watir.com/book - author
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]