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 <felipedr...@gmail.com>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 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: watir-general@googlegroups.com
> To unsubscribe: 
> watir-general+unsubscr...@googlegroups.com<watir-general%2bunsubscr...@googlegroups.com>
>

-- 
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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com

Reply via email to