At 12:47 PM 8/19/2005, Shao Kang Tat wrote:
So I'm assuming Watir will always start at index 0 when using .times do|x|is that right? Would it be possible to make watir Know what iscalling .times so that it can start at a different index - in thiscase, tables? I actually do use .times do|x| in some cases but Inever tried with tables until now because I assumed it would start atindex 0.
Shao

Ruby always starts at index 0.

We made a big mistake in designing Watir and used one-based indexing. The problems you are running into are consequences of our design error.

For example,

  ie.table(:name, 'foo')[2][3].text

is the same as

  ie.table(:name, 'foo').to_a[1][2]

This is because the first is 'watir' and the second is 'ruby', but we realize that everyday users will never be likely to figure this out.

We've discussed changing Watir to use zero-based indexing, but are concerned about compatability. Paul discussed this in a recent email. Comments? Anyone opposed to a switch?

Bret



_____________________
 Bret Pettichord
 www.pettichord.com

_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to