lib/taza/browser.rb in scudco-taza-0.8.1 vs lib/taza/browser.rb in scudco-taza-0.8.3
- old
+ new
@@ -15,19 +15,36 @@
end
private
def self.create_watir(params)
- require 'watir'
- Watir::Browser.default = params[:browser].to_s
- Watir::Browser.new
+ method = "watir_#{params[:browser]}"
+ raise BrowserUnsupportedError unless self.respond_to?(method)
+ watir = self.send(method).new
+ watir
end
def self.create_selenium(params)
require 'selenium'
Selenium::SeleniumDriver.new(params[:server_ip],params[:server_port],'*' + params[:browser].to_s,params[:timeout])
end
+ def self.watir_firefox
+ require 'firewatir'
+ FireWatir::Firefox
+ end
+
+ def self.watir_safari
+ require 'safariwatir'
+ Watir::Safari
+ end
+
+ def self.watir_ie
+ require 'watir'
+ Watir::IE
+ end
end
+ # We don't know how to create the browser you asked for
+ class BrowserUnsupportedError < StandardError; end
end