lib/watirsplash/page/base.rb in watirsplash-2.1.1 vs lib/watirsplash/page/base.rb in watirsplash-2.2.0

- old
+ new

@@ -7,19 +7,26 @@ @@url = "about:blank" def url url @@url = url end + end def initialize(browser=nil) if browser @browser = WatirSplash::Browser.current = browser else - @browser = WatirSplash::Browser.new + @browser = (WatirSplash::Browser.current && + WatirSplash::Browser.current.exists?) || + WatirSplash::Browser.new @browser.goto @@url end end + + def redirect_to page, browser=nil + page.new browser || WatirSplash::Browser.current + end def modify element, methodz methodz.each_pair do |meth, return_value| element.instance_eval do instance_variable_set("@_#{meth}_return_value_proc", return_value)