Hi Chris,

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

One thing I noticed is that when you install 'watir' using 'watir_installer.exe' located in 'installer' folder it install wrong version of 'watir.rb' file. Its installs 'Watir 1.4.1' which doesn't contain xpath support. I think you should use either 'install.rb' file for installation or copy the files manually.

I tried the same code & its working on my machine. I was able click the image map. Make sure that the following things are in place:
1. You have latest version of 'watir.rb' file.
2. You have copied 'elements.rb' & 'functions.rb' to [ruby installation directory]/lib/ruby/1.8/rexml

I don't think you need any thing else than this. Just let me know if problem still persists.

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

Reply via email to