Closed gonzalogtesta closed 14 years ago
Could you provide some example HTML that will reproduce the error?
Thanks. The problem is that your XPath finds a a td element, but table() expects a table element. I will add a guard for this in Celerity.
You should change:
puts browser.table(:xpath, "//*[@id='test']/table/tbody/tr[5]/td/table[2]/tbody/tr/td").exist?
to
puts browser.cell(:xpath, "//*[@id='test']/table/tbody/tr[5]/td/table[2]/tbody/tr/td").exist?
At least in Celerity, cell() can also be replaced with td(). Even if Watir understands the exist? call, I suspect you will run into problems trying to use the returned element later, since the underlying DOM object is not a table.
If you just want to verify that the XPath is valid, you could also use
browser.element_by_xpath("//....").exists?
When verifying if a table exist or if it's visible, the following error message is returned from jruby:
C:/Program Files/jruby-1.4.0/lib/ruby/gems/1.8/gems/celerity-0.7.9/lib/celerity/ elements/table.rb:25:in
locate': undefined method
getRows' for #<HtmlTableData Cell:0x1c26db4> (NoMethodError) from C:/Program Files/jruby-1.4.0/lib/ruby/gems/1.8/gems/celerity-0.7.9/ lib/celerity/element.rb:174:inassert_exists' from C:/Program Files/jruby-1.4.0/lib/ruby/gems/1.8/gems/celerity-0.7.9/ lib/celerity/element.rb:186:in
exists?'