Actually, no. The order makes no difference. Index is always applied 
"last" no matter where it is specified in the arguments.

Bret

Michael Hwee wrote:
> There is high important to less important in multiple attributes search.
>
> In your case, you have    ie.text_field(:index => 2 , :name => "q")
> To us, it means
> - find text_field with index=2
> - comfirm that it also has name='q'
>
> So, no wonder you are getting non_existance error if you have other 
> text_fields with no 'q' as name.
>
> Correct way is: ie.text_field(:name => "q", :index => 2)
>
>
>
>
> ----- Original Message ----
> From: Isabel <joybe...@gmail.com>
> To: Watir General <watir-general@googlegroups.com>
> Cc: charley.ba...@gmail.com
> Sent: Sunday, March 22, 2009 10:20:19 PM
> Subject: [wtr-general] Multiple Attributes for Input Elements
>
>
> Hi,
> I tried to use the code below to set a value in the text box of the
> google search page.
>
> require 'watir'
> ie=Watir::IE.new
> ie.goto "http://google.com/";
> ie.text_field(:index => 2 , :name => "q").set("xyz")
>
> But I receive an error which is:
>
>   
>> ruby testmultiAttri.rb
>>     
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in
> `assert_exists': Unable to locate element, using
> {:index=>2, :name=>"q"} (Watir::Exception::UnknownObjectException)
>     from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:
> 284:in `enabled?'
>     from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:
> 56:in `assert_enabled'
>     from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> input_elements.rb:323:in `set'
>     from testmultiAttri.rb:4
>   
>> Exit code: 1
>>     
>
> Please do let me know where I am going wrong.
> The text box gets identified correctly if I use any one of the two
> attributes.
>
> Thanks and Regards.
>
>
>
> On Feb 7, 9:51 pm, Charley Baker <charley.ba...@gmail.com> wrote:
>   
>> Multiple attributes for input elements are now supported in the latest
>> version of Watir - 1.6.2. The wiki has also been updated.
>>
>> Charley Baker
>> blog:http://charleybakersblog.blogspot.com/
>> Lead Developer, Watir,http://wtr.rubyforge.org
>> QA Architect, Gap Inc Direct
>>
>> On Fri, Feb 6, 2009 at 11:20 PM, Vens <venugopal.devarako...@gmail.com>wrote:
>>
>>
>>
>>
>>
>>
>>
>>     
>>> Hi:
>>>       
>>> I just started using Watir for automating few web UIs. During this I
>>> came across a situation where I had to put in data to a text field but
>>> incidently there are 2 text boxes having the same name. Please look at
>>> the snippet below:
>>>       
>>> <div class="boxed">
>>> <h3 class="title"> Authorize NG IDs </h3>
>>>  <form action="ser.do" method="post" name="sAFrm">
>>>   <input type="hidden" value="authorize" name="dispatch"/>
>>>   <table>
>>>  <tbody>
>>>        <tr>
>>>        <td colspan="2"><div class="infomark"> You can enter comma
>>> separated multiple ngids </div></td>
>>>        </tr>
>>>        <tr>
>>>              <th> MID </th>
>>>              <td> <select size="1" name="mid"></select></td>
>>>       </tr>
>>>        <tr>
>>>              <th> NG IDs </th>
>>>               <td><input type="text" value="" size="100"
>>> maxlength="200"
>>> name="ngids"/></td>
>>>       </tr>
>>> </tbody>
>>> </table>
>>> </form>
>>> </div>
>>>       
>>> <div class="boxed">
>>> <h3 class="title"> Authorize NG IDs </h3>
>>>  <form action="ser.do" method="post" name="sAFrm">
>>>   <input type="hidden" value="unauthorize" name="dispatch"/>
>>>   <table>
>>>  <tbody>
>>>        <tr>
>>>        <td colspan="2"><div class="infomark"> You can enter comma
>>> separated multiple ngids </div></td>
>>>        </tr>
>>>        <tr>
>>>              <th> MID </th>
>>>              <td> <select size="1" name="mid"></select></td>
>>>        </tr>
>>>        <tr>
>>>              <th> NG IDs </th>
>>>               <td><input type="text" value="" size="100"
>>> maxlength="200"
>>> name="ngids"/></td>
>>>       </tr>
>>> </tbody>
>>> </table>
>>> </form>
>>> </div>
>>>       
>>> When I looked into
>>> http://wiki.openqa.org/display/WTR/Multiple+Attributesit
>>> said it is not implemented for input elements.  Can you help me solve
>>> this.
>>>       
>>> Regards
>>> Venu
>>>       
>
> >
>   


-- 
Bret Pettichord
CTO, WatirCraft LLC, www.watircraft.com
Lead Developer, Watir, www.watir.com
Blog, www.io.com/~wazmo/blog
Twitter, www.twitter.com/bpettichord

Watir Training: Austin March 25-26, Portland/Beaverton April 16-17
www.watircraft.com/training


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to