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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord
Sent: Tuesday, April 18, 2006 11:26 PM
To: [email protected]
Subject: Re: [Wtr-general] XPath performance and ole_object questions

 

On 4/9/06, Greg McShea <[EMAIL PROTECTED]> 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

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to