hi,
I'm creating an automated tests that should navigate back a few steps. Is it possible to do so in Watir??
I'm navigating to a resultlist page and want to go back to the start of my test just by clicking back (windows browser). Thnx
hi,
I'm creating an automated tests that should navigate back a few steps. Is it possible to do so in Watir??
I'm navigating to a resultlist page and want to go back to the start of my test just by clicking back (windows browser). Thnx
This is how i tried to do it:
@site.ie.wait_until(1200) { |ie| ie.contains_text(/Sort after/) }
2.times{@site.ie.back
}
If you have a Watir::IE object, then #back is a method that does what you are looking for:
What error are you seeing?
Example code that uses Watir's #back call (based on the standard Wikipedia example):
require 'watir'
test_site = 'http://www.google.com/'
ie = Watir::IE.new
ie.goto(test_site)
ie.text_field(:name, "q").set("pickaxe")
ie.button(:name, "btnG").click
if ie.text.include?("Programming Ruby")
puts "Test Passed. Found the test string: 'Programming Ruby'."
else
puts "Test Failed! Could not find: 'Programming Ruby'."
end
ie.back
if ie.url == test_site
puts "Test Passed. Returned to search page."
else
puts "Test Failed! URL is now #{ie.url}."
end
ie.close