Felipe, To test the :index locator, I created this simple file:
<input type="text" maxlength="15" tabindex="4901"> <input type="text" maxlength="15" tabindex="4902"> <input type="text" maxlength="15" tabindex="4903"> <input type="text" maxlength="15" tabindex="4904"> <input type="text" maxlength="15" tabindex="4905"> <input type="text" maxlength="15" tabindex="4906"> <input type="text" maxlength="15" tabindex="4907"> <input type="text" maxlength="15" tabindex="4908"> <input type="text" maxlength="15" tabindex="4909"> <input type="text" maxlength="15" tabindex="4910"> What happens if you try this: require "rubygems" require "watir" @browser = FireWatir::Firefox.new @browser.goto "file:///c:/teste.html" i = 1 1.upto(@browser.text_fields.size) do @browser.text_field(:index, i).set i.to_s i += 1 end You should be able to identify the correct index to use on your field with that. FK On Thu, May 6, 2010 at 4:52 PM, Felipe Pedrini <[email protected]>wrote: > Hi George, > > It's not a site developed by my team. Our role is to apply the > automation test on it. I have no way to change anything on it. To use > the index attribute on HTML source. And access it using the :index. > > But I've tried this anyway, using the :index hoping it will bind the > tabindex. But, it was just a hope, it doesn't work (same error). > > Thanks > > On 6 maio, 16:25, George <[email protected]> wrote: > > Hi there, > > > > I'm not sure how many text fields are on the page, but have you > > considered using the :index attribute? > > > > @ie.text_field(:index, 5).set "something" > > > > On May 6, 12:07 pm, Felipe Pedrini <[email protected]> wrote: > > > > > > > > > Hello, FK, > > > > > Yes, it was I thought, a bug, but I came ask here just to confirm. > > > > > I've tried the workaround, and I have no success. The error continues: > > > > > D:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/ > > > element.rb:907:in `assert_exists': Unable to locate element, > > > using :xpath, "//*...@tabindex='4901']" > > > (Watir::Exception::UnknownObjectException) > > > > > And, yes, my tabindex is unique. Do you have any other sugestion? I'm > > > not a specialist in xpath queries. > > > > > Thanks! > > > > > On 6 maio, 15:42, Felipe Knorr Kuhn <[email protected]> wrote: > > > > > > Hello, Felipe, > > > > > > It sure does look like a bug. > > > > > > A workaround would be using the wildcard selector like this: > > > > > > @ie.text_field(:xpath, "//*...@tabindex='4901']").set "test" > > > > > > Hopefully your tabindex property is unique to all elements :) > > > > > > Regards, > > > > > > FK > > > > > > On Thu, May 6, 2010 at 2:55 PM, Felipe Pedrini < > [email protected]>wrote: > > > > > > > Hi guys, > > > > > > > I'm evaluating Watir, and I'm trying to simple get an element using > > > > > its XPath. But I'm having a problem. > > > > > > > First look at the problem. > > > > > > > I have the following element in my page: > > > > > > > <input type="text" maxlength="15" tabindex="4901"> > > > > > > > Notice that it doesn't have name neither id attributes. When I try > to > > > > > get it using xpath: > > > > > > > browser.text_field(:xpath, "// > > > > > inp...@tabindex='4901']").set("something") > > > > > > > I get the following error: > > > > > > > D:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/ > > > > > element.rb:907:in `assert_exists': Unable to locate element, > > > > > using :xpath, "// > > > > > inp...@tabindex='4901']" (Watir::Exception::UnknownObjectException) > > > > > from D:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/ > > > > > firewatir/elements/text_field.rb:149:in `set' > > > > > from waitir_adm_jp_1.rb:10 > > > > > > > Watir can't find the element. But if I try to get other element > that > > > > > have id or name attributes using xpath (in the very same page) I > can > > > > > get it, without problems. > > > > > > > My guess is that Watir can't acess elements without name or id > > > > > attribute, even if it isn't used in xpath query, the element must > have > > > > > it. Is it right? If not, where am I making mistake? > > > > > > > Thanks. > > > > > > > -- > > > > > Before posting, please readhttp://watir.com/support. In short: > search > > > > > before you ask, be nice. > > > > > > > You received this message because you are subscribed to > > > > >http://groups.google.com/group/watir-general > > > > > To post: [email protected] > > > > > To unsubscribe: > > > > > [email protected]<watir-general%[email protected]> > <watir-general%2bunsubscr...@goog legroups.com> > > > > > > -- > > > > Before posting, please readhttp://watir.com/support. In short: > search before you ask, be nice. > > > > > > You received this message because you are subscribed tohttp:// > groups.google.com/group/watir-general > > > > To post: [email protected] > > > > To unsubscribe: > > > > [email protected]<watir-general%[email protected]> > > > > > -- > > > Before posting, please readhttp://watir.com/support. In short: search > before you ask, be nice. > > > > > You received this message because you are subscribed tohttp:// > groups.google.com/group/watir-general > > > To post: [email protected] > > > To unsubscribe: > > > [email protected]<watir-general%[email protected]> > > > > -- > > Before posting, please readhttp://watir.com/support. In short: search > before you ask, be nice. > > > > You received this message because you are subscribed tohttp:// > groups.google.com/group/watir-general > > To post: [email protected] > > To unsubscribe: > > [email protected]<watir-general%[email protected]> > > -- > Before posting, please read http://watir.com/support. In short: search > before you ask, be nice. > > You received this message because you are subscribed to > http://groups.google.com/group/watir-general > To post: [email protected] > To unsubscribe: > [email protected]<watir-general%[email protected]> > -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: [email protected] To unsubscribe: [email protected]
