I am new to WATIR testing (and I like it!) And ran into the problem of reorienting my WATIR script to a newly opened window. Here is my (simplified) script ....
require 'rubygems'
require 'watir-webdriver'
browser=Watir::Browser.new
browser.goto("http://0:3050")
browser.text_field(:name,"userkey300203830").set("OKJHNB")
browser.button(:id, "interview48").click
puts "Expected Result:"
puts "A successful display of cars"
if browser.window(:title=>"300203830").exists?
puts " Test passed. New window opened!"
else
puts " Test Failed! No window found"
end
Everything works to the very end. After pressing the "interview48" key, a new window opens with the heading "300203830". Looks like I'm finding this, but I just don't know how to focus on this window now.
source
share