I'm somewhat stumped trying to select the second table out of multiple identical tables on the page in Watir 2.0.1. It should be simple, right?

In Watir-WebDriver:

carts = @browser.*tables*(:xpath => table_xpath("carts"))[1]
# works

carts = @browser.*table*(:xpath => table_xpath("carts"), :index => 1)
# works as well

In Watir:

carts = @browser.*tables*(:xpath => table_xpath("carts"))
# Watir::Exception::MissingWayOfFindingObjectException: xpath is an unknown way of finding a <Table> element

carts = @browser.*table*(:xpath => table_xpath("carts"), :index => 1)
# Selects the first table regardless of the index passed. I have an impression that it is ignored because carts = @browser.*table*(:xpath => table_xpath("carts"), :index => 2) selects the same table.

One solution I could think of so far is to add index into the XPath expression itself. Another is to introduce table ids into the source application.
Both are somewhat hairy.

--
DK
AIM: DKroot1, Skype: DKroot

--
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]

Reply via email to