The Watir tabindex method you used is for HTMl tags with a tabindex
attribute.
For example:
<a href="#interactive" tabindex="1" >Link A</a>
<a href="#interactive" tabindex="2" >Link B</a>
As you mention, your web page is NOT using the tabindex attribute,
thus the method return 0.
Perhaps you could use AutoIt's send_keys command to tab through the
web page, e.g.
# Advance to the next object in the tabbing order
browser.send_keys("{TAB}")
and after each command detect which object has focus. You could then
collect the tabbing
order, which could be saved and compared to the tabbing order found on
subsequent runs.
Sorry but I don't know of a means to tell which object has focus,
Watir's Watir::Element class lack an in_focus? method.
It has focus method to set the focus but not a method to verify if it
is in focus.
Perhaps someone else can assist with that.
On May 14, 7:06 pm, George <[email protected]> wrote:
> I'm trying to verify the tab order on a login page by accessing the
> tabindex attribute. Unfortunately, the tabindex isn't specified in the
> HTML code and performing the following code isn't helping me. Does
> anybody have any ideas?
>
> ~~~~~~~~~~~~~~~~~~
>
> @browser = Watir::IE.attach(:title, /Login/)
>
> puts @browser.text_field(:id, 'username').document.tabindex # returns
> 0
>
> puts @browser.text_field(:id, 'username').attribute_value('tabindex')
> # returns 0
>
> puts @browser.text_field(:id, 'password').document.tabindex # returns
> 0, expected 1
>
> puts @browser.text_field(:id, 'password').document.tabindex # returns
> 0, expected 1
>
> ~~~~~~~~~~~~~~~~~~
>
> --
> 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]
--
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]