I tried it both ways with the same results. I found that it works when I use the syntax below. I have to change my code in all my old scripts but it will run with old and new versions of Watir with this change.
use: ie.table(:id, 'Menu').row(:index => 1).click() # this syntax works when the switch is set instead of: ie.table(:id, 'Menu').rows[1].click() # it would be nice if this worked but it does not On Sep 6, 2:25 pm, Jarmo Pertman <[email protected]> wrote: > Does Watir::Browser.new work instead of Watir::IE.new? > > Jarmo > > On Sep 2, 6:45 pm, George Wiley <[email protected]> wrote: > > > > > Here is my test code. Maybe you can see what my problem is. The below > > code works in 2.0.1 if IDX value is 0 but fails if IDX is 1. > > > require 'watir' > > Watir::IE.zero_based_indexing = false > > # Watir.options[:zero_based_indexing] = false > > > test_site = 'http://mysite.com' > > > ie = Watir::IE.new() > > ie.goto(test_site) > > > IDX = 1 # This works in 1.6.2 but does not work in 2.0.1 with either > > of the zero_based_indexing switches set above. > > > ie.table(:id, 'Menu').rows[IDX].click() > > > On Aug 27, 7:22 am, Jarmo Pertman <[email protected]> wrote: > > > > What is the exact code when you load the Watir and open up a browser > > > too? > > > > The Watir.options line should be right after require "watir" and it > > > also depends of the code you're using to create/attach browser > > > instance. > > > > If you're not using Watir::Browser, but use Watir::IE instead then you > > > should use Watir::IE.zero_based_indexing = false instead. > > > > Jarmo > > > > On Aug 26, 6:00 pm, George Wiley <[email protected]> wrote: > > > > > I ran across an issue with Ruby 1.9.2, Watir 2.01 and compatibility with > > > > older versions without zero based indexing. > > > > > I'm running on Win7, IE8. I have a page with 5 radio buttons with the > > > > below > > > > option set in my code. > > > > > Watir.options[:zero_based_indexing] = false > > > > > Here is my code: > > > > > ie.radios[5].click > > > > ie.radios[4].click > > > > ie.radios[3].click > > > > ie.radios[2].click > > > > ie.radios[1].click > > > > > This does not work. I get an error for index 5. I assumed that my old > > > > code > > > > would be able to run in the zero based indexing environment with the > > > > above > > > > option set. > > > > > This code works fine: > > > > > ie.radios[4].click > > > > ie.radios[3].click > > > > ie.radios[2].click > > > > ie.radios[1].click > > > > ie.radios[0].click # zero based indexing > > > > > Is this the way it is supposed to work for radio buttons?- Hide quoted > > > > text - > > > > - Show quoted text - > > > On Aug 27, 7:22 am, Jarmo Pertman <[email protected]> wrote: > > > > What is the exact code when you load the Watir and open up a browser > > > too? > > > > The Watir.options line should be right after require "watir" and it > > > also depends of the code you're using to create/attach browser > > > instance. > > > > If you're not using Watir::Browser, but use Watir::IE instead then you > > > should use Watir::IE.zero_based_indexing = false instead. > > > > Jarmo > > > > On Aug 26, 6:00 pm, George Wiley <[email protected]> wrote: > > > > > I ran across an issue with Ruby 1.9.2, Watir 2.01 and compatibility with > > > > older versions without zero based indexing. > > > > > I'm running on Win7, IE8. I have a page with 5 radio buttons with the > > > > below > > > > option set in my code. > > > > > Watir.options[:zero_based_indexing] = false > > > > > Here is my code: > > > > > ie.radios[5].click > > > > ie.radios[4].click > > > > ie.radios[3].click > > > > ie.radios[2].click > > > > ie.radios[1].click > > > > > This does not work. I get an error for index 5. I assumed that my old > > > > code > > > > would be able to run in the zero based indexing environment with the > > > > above > > > > option set. > > > > > This code works fine: > > > > > ie.radios[4].click > > > > ie.radios[3].click > > > > ie.radios[2].click > > > > ie.radios[1].click > > > > ie.radios[0].click # zero based indexing > > > > > Is this the way it is supposed to work for radio buttons?- Hide quoted > > > > text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
