Hello,
I want to write a script that clicks on all the images present on a
given web page. The goal is to ultimately see which images link to
anything. I can't use the 'links' collection as I want to catch
javascript redirections as well.
-------
require 'rubygems'
require 'watir'
test_site = "http://<my test site>"
Watir::Browser.default = 'firefox'
browser = Watir::Browser.new
browser.goto test_site
browser.images.each do |img|
img.click
sleep 5
end
------
So, running this on a very specific site, I get the following stack
trace:
/opt/local/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/
jssh_socket.rb:12:in `js_eval': arr_coll_IMG_0[2] is undefined
(JsshSocket::JSTypeError)
from /opt/local/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/
jssh_socket.rb:20:in `js_eval_method'
from /opt/local/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/
element.rb:931:in `enabled?'
from /opt/local/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/
element.rb:917:in `assert_enabled'
from /opt/local/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/
element.rb:1067:in `click'
from watir-test.rb:11
from /opt/local/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/
element_collections.rb:141:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/
element_collections.rb:140:in `each'
from watir-test.rb:10
Am I doing something wrong / missing some mandatory check? I am very
new to Watir.
Here is my environment.
OSX 10.6.4
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-darwin10]
firewatir (1.6.5)
firefox 3.6.8
Contact me privately to get the URL I am testing on (balexis @ gmail)
Thanks
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
You received this message because you are subscribed to
http://groups.google.com/group/watir-general
To post: [email protected]
To unsubscribe: [email protected]