Hi Angrez,
 
I've follwoed your steps and get a similar result (1 failure) when I run core_tests.rb. A couple of strange things.
1. I seem to have an extra test
2. the IE window is opened then immediately closed. Is this normal?
 
This is what I get:
 
Finished in 171.406 seconds.
  1) Failure:
test_http_errors(TC_Navigate) [./unittests/navigate_test.rb:51]:
<Watir::Exception::NavigationException> exception expected but none was thrown.
172 tests, 991 assertions, 1 failures, 0 errors
 
Anyway, I'm trying to run the following code just to get things started
 
require 'watir'
ie = Watir::IE.start("http://localhost/index.asp")
ie.element_by_xpath("//[EMAIL PROTECTED]'top_menu_map']/area[contains(@href , 'signup.htm')]/").click
The browser opens to the correct page but I get the following error
 
web_pages>ruby trial.rb
C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1922:in `elements_by_xpath': undefined method `elements' for nil:NilClass (NoMethodError)
        from C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1912:in `element_by_xpath'
        from trial.rb:5
 
I suspect there is something wrong with my xpath value. My xpath skills are more than a little rusty so I've used XPath Explorer (http://www.purpletech.com/xpe/). I also tried ie.element_by_xpath("//area[contains(@href , 'signup.htm')]/").click and get the same result.
 
Any ideas what I could be doing wrong?
 
Regards
 
Chris
-----Original Message-----
From: Angrez Singh [mailto:[EMAIL PROTECTED]
Sent: Friday, February 24, 2006 10:09 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] xpath support doesn't work for me

Hi Chris,

I installed 'watir' from the tar ball. Steps I followed:

1. Manually copied 'watir.rb' & 'watir' folder to [ruby installation directory]/lib/ruby/site_ruby/1.8/
2. Manually copied 'doc', 'examples', 'unittests' folders to [watir installation directory]

I was able to run the core tests successfullly.

$ruby core_tests.rb
Loaded suite core_tests
Started
............................................................................................................................................................................
Finished in 88.906 seconds.

172 tests, 991 assertions, 0 failures, 0 errors

But when I tried to run xpath_tests.rb or all_tests.rb I got lots of exceptions & errors. One thing that was strange was two IE instances were getting opened when I tried to run any of these files. Then one got closed & there were lot of failures each was saying 'The object invoked has disconnected from its clients.'. So what I think is the IE instance that was closed (don't know how) was the correct IE that was being referenced in the tests. The IE instance that remained open (don't know how it got opened) is the one that is not used anywhere in the scripts.

Anyways, successful run of core_tests.rb indicates that xpath is working fine because xpath unit tests are also included in the core tests.

Regards,
Angrez
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to