Try specifying the Frame by their index. You've already found:
browser.show_frames:
there are 2 frames
frame index: 1 name:
frame index: 2 name:
So try locating them using the frame's index
depending on which iFRame your element resides within:
browser.frame(:index => 1).text_field(:id =>
'searchByElelastName').set "Stuff"
browser.frame(:index => 2).text_field(:id =>
'searchByElelastName').set "Stuff"
Joe
On Aug 18, 1:37 pm, Mitchell Presar <[email protected]> wrote:
> <frame src="/AGCMWeb/staticcontent/html/blank.html">
> <frame src="/AGCMWeb/loadQuoteOptions.do?origin=task">
>
> <div class="action_buttons">
> <input type="button" name="submitButton" tabindex="7" value="Submit"
> onclick="javascript:submitPage();" class="regButtonNew">
> <input type="button" name="cancelButton" tabindex="8" value="Cancel"
> onclick="cleanupSession();" class="regButtonNew">
>
> </div>
>
> This is the relevant html involved. There are a lot of divs under the
> frame that contain irrelevant info.
>
> On Aug 18, 3:03 pm, Rahul Sharma <[email protected]> wrote:
>
> > Can you paste the HTML please
> > On 18 Aug 2011, at 19:37, Mitchell Presar wrote:
>
> > > Ok, follow up with the next screen I have.
>
> > > I have 2 frames, each with no name and no id. They have an src tag
> > > though.
>
> > > So my browser.show_frames is:
> > > there are 2 frames
> > > frame index: 1 name:
> > > frame index: 2 name:
>
> > > I need to access the second frame. And can't.
>
> > > On Aug 18, 12:05 pm, Rahul Sharma <[email protected]> wrote:
> > >> Cool. So you need to access the frame first and then the text field ;)
>
> > >> On 18 August 2011 17:03, Mitchell Presar <[email protected]> wrote:
>
> > >>> Yeah, it was in a frame. That was the problem. Thanks.
>
> > >>> On Aug 18, 11:56 am, Rahul Sharma <[email protected]> wrote:
> > >>>> Please paste the full HTML. IS the textfield inside a frame?
>
> > >>>> On 18 August 2011 16:54, Mitchell Presar <[email protected]> wrote:
>
> > >>>>> returns false
>
> > >>>>> I would post the rest of the html, but there are too many lines in it.
>
> > >>>>> But there is a form its in with name, action, and method
> > >>>>> it is within a table with no name
> > >>>>> in a div with id = portletgrp
> > >>>>> and in a table class = "findClientPortletContentHeader"
>
> > >>>>> On Aug 18, 11:48 am, Rahul Sharma <[email protected]> wrote:
> > >>>>>> Can you try in irb browser.text_field(:id =>
> > >>>>> ''searchByElelastName").exists?
> > >>>>>> and see whether it returns true or false?
>
> > >>>>>> On 18 August 2011 16:45, Mitchell Presar <[email protected]>
> > >>> wrote:
>
> > >>>>>>> Watir::Exception::UnknownObjectException: Unable to locate element,
> > >>>>>>> using {:name=>"finderCriteria.lastName"}
> > >>>>>>> from
> > >>> C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-1.7.1/lib/watir/
> > >>>>>>> element.rb:58:in `assert_exists'
> > >>>>>>> from
> > >>> C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-1.7.1/lib/watir/
> > >>>>>>> input_elements.rb:366:in `set'
> > >>>>>>> from (irb):28
> > >>>>>>> from C:/Ruby192/bin/irb:12:in `<main>'
>
> > >>>>>>> On Aug 18, 11:41 am, Rahul Sharma <[email protected]>
> > >>> wrote:
> > >>>>>>>> Can you paste the full error?
>
> > >>>>>>>> On 18 August 2011 16:38, Mitchell Presar <[email protected]>
> > >>>>> wrote:
>
> > >>>>>>>>> Same error.
>
> > >>>>>>>>> Unable to locate element using {:name =>
> > >>> "finderCriteria.lastName"}
>
> > >>>>>>>>> On Aug 18, 11:33 am, Rahul Sharma <[email protected]>
> > >>>>> wrote:
> > >>>>>>>>>> Can you try by :name and see if it returns the same error?
>
> > >>>>>>>>>> On 18 August 2011 16:23, Mitchell Presar <
> > >>> [email protected]>
> > >>>>>>> wrote:
>
> > >>>>>>>>>>> Hi,
>
> > >>>>>>>>>>> I've been using Watir for about a day now and having
> > >>> trouble
> > >>>>>>> accessing
> > >>>>>>>>>>> a text field that is within a table.
>
> > >>>>>>>>>>> I tried to access it by this:
>
> > >>>>>>>>>>> browser.text_field(:id => 'searchByElelastName').set
> > >>> "Stuff"
>
> > >>>>>>>>>>> returns that it is unable to locate element.
>
> > >>>>>>>>>>> This is the html for the element I want to access.
>
> > >>>>>>>>>>> <input type="text" name="finderCriteria.lastName"
> > >>>>> maxlength="25"
> > >>>>>>>>>>> value="" style="width:160px;" class="regtxtfield"
> > >>>>>>>>>>> id="searchByElelastName">
>
> > >>>>>>>>>>> Any suggestions?
>
> > >>>>>>>>>>> --
> > >>>>>>>>>>> Before posting, please readhttp://watir.com/support. In
> > >>> short:
> > >>>>>>> search
> > >>>>>>>>>>> before you ask, be nice.
>
> > >>>>>>>>>>> [email protected]
> > >>>>>>>>>>>http://groups.google.com/group/watir-general
> > >>>>>>>>>>> [email protected]
>
> > >>>>>>>>>> --
> > >>>>>>>>>> Regards,
>
> > >>>>>>>>>> Rahul Sharma
> > >>>>>>>>>> Ph:+44 7800 736851
>
> > >>>>>>>>> --
> > >>>>>>>>> Before posting, please readhttp://watir.com/support. In short:
> > >>>>> search
> > >>>>>>>>> before you ask, be nice.
>
> > >>>>>>>>> [email protected]
> > >>>>>>>>>http://groups.google.com/group/watir-general
> > >>>>>>>>> [email protected]
>
> > >>>>>>>> --
> > >>>>>>>> Regards,
>
> > >>>>>>>> Rahul Sharma
> > >>>>>>>> Ph:+44 7800 736851
>
> > >>>>>>> --
> > >>>>>>> Before posting, please readhttp://watir.com/support. In short:
> > >>> search
> > >>>>>>> before you ask, be nice.
>
> > >>>>>>> [email protected]
> > >>>>>>>http://groups.google.com/group/watir-general
> > >>>>>>> [email protected]
>
> > >>>>>> --
> > >>>>>> Regards,
>
> > >>>>>> Rahul Sharma
> > >>>>>> Ph:+44 7800 736851
>
> > >>>>> --
> > >>>>> Before posting, please readhttp://watir.com/support. In short: search
> > >>>>> before you ask, be nice.
>
> > >>>>> [email protected]
> > >>>>>http://groups.google.com/group/watir-general
> > >>>>> [email protected]
>
> > >>>> --
> > >>>> Regards,
>
> > >>>> Rahul Sharma
> > >>>> Ph:+44 7800 736851
>
> > >>> --
> > >>> Before posting, please readhttp://watir.com/support. In short: search
> > >>> before you ask, be nice.
>
> > >>> [email protected]
> > >>>http://groups.google.com/group/watir-general
> > >>> [email protected]
>
> > >> --
> > >> Regards,
>
> > >> Rahul Sharma
> > >> Ph:+44 7800 736851
>
> > > --
> > > Before posting, please readhttp://watir.com/support. In short: search
> > > before you ask, be nice.
>
> > > [email protected]
> > >http://groups.google.com/group/watir-general
> > > [email protected]
>
> > Regards,
> > Rahul Sharma
--
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]