I have sth like this:
require ‘rubygems’
require ‘watir-webdriver’
@browser = Watir::Browser.new :firefox
def adopt_puppy_number(num)
@browser.button(:value => ‘View details’, :index => num - 1).click
@browser.button(:value => ‘Adopt Me!’).click
end
@browser.goto ‘http://puppies.herokuapp.com’
adopt_puppy_number 1
@browser.button(:value => ‘Adopt Another Puppy’).click
adopt_puppy_number 2
but I got :
/var/lib/gems/1.9.1/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:536:in
assert_element_found': unable to locate element, using {:value=>"View details", :index=>0, :tag_name=>"button"} (Watir::Exception::UnknownObjectException) from /var/lib/gems/1.9.1/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:508:in
assert_exists’
from
/var/lib/gems/1.9.1/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:114:in
click' from /home/giz/Downloads/RubymineProjects/learn_watir/thirdscript_dry.rb:6:in
adopt_puppy_number’
from
/home/giz/Downloads/RubymineProjects/learn_watir/thirdscript_dry.rb:11:in
<top (required)>' from -e:1:in
load’
from -e:1:in `’
Why>
I searched sth like maye I shoud add some wait command bu WHERE exactly
and which one?
Thanks