accessing tableCell through XPath

16 views
Skip to first unread message

Shylaja

unread,
Mar 16, 2009, 8:34:17 AM3/16/09
to Watir General
Hi
Iam trying to access the table cell through XPath wiht the following
expression

cell = ie.td(:xpath, "//td[contains(., 'Sales')]/") and get the
following error
undefined method `td' for #<Watir::IE:0x3b94b84> (NoMethodError)

Alternately if i change the expression as
cell = ie.element_by_xpath("//td[contains(text(), 'All
SalesOrders')]/") i always get a return value as NIL.

Is there a way to check if the xpath expression is correct?

Angrez Singh

unread,
Mar 16, 2009, 8:50:37 AM3/16/09
to watir-...@googlegroups.com
try
cell = ie.cell(:xpath, "//td[contains(., 'Sales')]/")

- Angrez

Shylaja

unread,
Mar 16, 2009, 8:56:52 AM3/16/09
to Watir General
Angrez

When i try to use this expression i get the following error

ie.cell(:xpath, "//td[contains(., 'Sales')]/").click()

`assert_exists': Unable to locate element, using :xpath, "//td
[contains(., 'Sales')]/" (Watir::Exception::UnknownObjectException)

On Mar 16, 5:50 pm, Angrez Singh <ang...@gmail.com> wrote:
> try
> cell = ie.cell(:xpath, "//td[contains(., 'Sales')]/")
>
> - Angrez
>

wesley chen

unread,
Mar 16, 2009, 9:29:57 AM3/16/09
to watir-...@googlegroups.com
Try: ie.cell(:xpath, "//td[contains(text(), 'Sales')]/").click


Thanks.
Wesley Chen.
Reply all
Reply to author
Forward
0 new messages