Hello, That's weird. I noticed you're using Firefox, so I tested it under FF and it worked as well:
require "rubygems" require "watir" @browser = FireWatir::Firefox.new @browser.goto "file:///c:/teste.html" @browser.text_field(:xpath, "//*...@tabindex='4901']").set "teste" puts @browser.text_field(:xpath, "//*...@tabindex='4901']").value >ruby input.rb teste >Exit code: 0 My environment: Microsoft Windows XP [Version 5.1.2600] ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] (Fire)Watir 1.6.5 FK On Thu, May 6, 2010 at 4: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%[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]
