Review older messages again I see that the elements.rb and functions.rb are only supposed to be copied to C:\ruby\lib\ruby\1.8\rexml. I have done this and restored the original versions of the files to C:\ruby\lib\ruby\site_ruby\1.8\rexml. Now when I run my script I get a different error:
 
Unable to locate object, using xpath and //[EMAIL PROTECTED]'Delete']
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2102:in `assert_exists'
-----Original Message-----
From: Greg McShea [mailto:[EMAIL PROTECTED]
Sent: Friday, March 10, 2006 2:57 PM
To: wtr-general@rubyforge.org
Cc: [EMAIL PROTECTED]
Subject: Help with Watir/XPath

Hi,
 
I've reviewed all the XPath related posts here and am still unable to get a simple statement with xpath _expression_ working. Here is what I have done to setup my installation:
 
1. Installed ruby 1.8.2
2. Installed watir 1.4.1 using windows installer
3. Installed REXML 3.1.3
3. Downloaded the latest tarball
4. Copied TARBALL_HOME\watir\watir.rb to C:\ruby\lib\ruby\site_ruby\1.8
5. Copied TARBALL_HOME\watir\watir folder to C:\ruby\lib\ruby\site_ruby\1.8
6. Copied TARBALL_HOME\watir\doc, examples, and unittests folders to c:\watir
7. Copied TARBALL_HOME\watir\watir\rexml\elements.rb and functions.rb to C:\ruby\lib\ruby\site_ruby\1.8\rexml and C:\ruby\lib\ruby\1.8\rexml
 
Here is a snippet of the source I am testing:
<DIV style="LEFT: 0px; OVERFLOW: hidden; WIDTH: 655px; POSITION: absolute; TOP: 0px; HEIGHT: 148px">
  <SPAN style="LEFT: 0px; WIDTH: 655px; POSITION: absolute; TOP: 0px; HEIGHT: 148px">
    <BUTTON >Add</BUTTON>
    <BUTTON >Delete</BUTTON>
    <BUTTON >Reset</BUTTON>
  </SPAN>
</DIV>
 
Using "ie.button(:value, 'Delete').click" works fine.
 
The watir Xpath statements I have tried are:
ie.button(:xpath, "//button[text()='Delete']").click
ie.button(:xpath, "//[EMAIL PROTECTED]'Delete']").click
 
These both fail with the error:
The undefined method `root_node' for <UNDEFINED> ... </>:REXML::Document
c:/ruby/lib/ruby/site_ruby/1.8/rexml/xpath_parser.rb:154:in `expr'
 
I tried running the xpath_tests unit test but I ran into the problem described here:http://www.mail-archive.com/wtr-general%40rubyforge.org/msg02864.html
 
My application has many instances where there is no unique way to identify elements so using Xpath is a must for me.
Any help in getting this working is much appreciated.
 
Thanks,
Greg
 
 
 
 
 
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to