[Wtr-general] XPath performance and ole_object questions

Cain, Mark Mark_Cain at rl.gov
Wed Apr 19 10:06:40 EDT 2006


The error you are getting could also be cause by mal-formed HTML in your
page.  For instance if all your html tags do not have corresponding
ending tags then it may work fine in IE but anything remotely
XML/XSL-ish will not work.

 

--Mark

 

________________________________

From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Bret Pettichord
Sent: Tuesday, April 18, 2006 11:26 PM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] XPath performance and ole_object questions

 

On 4/9/06, Greg McShea <gregory.mcshea at oracle.com> wrote:

	Second, due to the XPath performance issue I was starting to
look at using ole_object method. I'm trying to execute the following
statement in my Watir script: 

	 

	ie.cell(:text,
"Reassign").ole_object().parentElement().parentElement().click()

	 

	I want to go up 2 levels from the td containing "Reassign" and
click that element.

	 

	I know that the cell is found successfully as I can flash it but
when I execute the statement I get the following error:

	 

	undefined method `parentElement' for nil:NilClass
	c:/Watir/examples/scratch.rb:17

	 

	I'm guessing this means the ole_object() method is not returning
anything. What am I doing wrong?


It could be that the call to ole_object() is returning nil, or that the
first call to parentElement() is returning nil. 

When you say "up 2 levels" what do you mean? do you mean the table
containing the row containing the cell? 
 

Another approach you can take is to do something like this:

# click on the row containing the Reassign cell 
ie.rows.find {|r| r.cell(:text, "Reassign")}.click

Bret

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060419/24865dc9/attachment.html 


More information about the Wtr-general mailing list