On Thu, Sep 9, 2010 at 6:45 PM, Ethan <[email protected]> wrote:
> For vapir, I am pondering on deprecating usage of :index in a hash of
> attributes specifying an element. I'm looking to get reactions on this idea
> from watir devs.
> Basically, when using a hash, :index is a special case and is extracted from
> the attributes hash. I'd prefer not to have that one hash key treated
> differently from every other, and I think that the alternative I propose
> (below) is more elegant all around.

It's not just this one key though - :xpath, :text, :value are all
special cases (with the latter two being equivalent in some cases) -
which makes me wonder if there are also other reasons why you'd like
it removed? Just curious. :)

> I would replace this functionality with index being specified as a subscript
> of element collections. That is, instead of:
> container.element(:class => 'some class', :index => 2)
> you'd do:
> container.elements(:class => 'some class')[2]
> The latter is already supported in vapir's master, though not yet released
> as a gem (due to difficulties with some cases of subscript being 0-indexed,

I don't really have a strong opinion on this, but I have no problem
removing :index if there is consensus for that. Passing a selector
hash to the plural Container methods is supported in watir-webdriver.

So ~1 from me.
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to