lib/taza/browser.rb in taza-0.8.7 vs lib/taza/browser.rb in taza-0.9.0
- old
+ new
@@ -1,30 +1,35 @@
module Taza
class Browser
-
+
# Create a browser instance depending on configuration. Configuration should be read in via Taza::Settings.config.
- #
+ #
# Example:
# browser = Taza::Browser.create(Taza::Settings.config)
#
def self.create(params={})
self.send("create_#{params[:driver]}".to_sym,params)
end
-
+
def self.browser_class(params)
self.send("#{params[:driver]}_#{params[:browser]}".to_sym)
end
- private
+ private
def self.create_watir(params)
method = "watir_#{params[:browser]}"
raise BrowserUnsupportedError unless self.respond_to?(method)
watir = self.send(method,params)
watir
end
+ def self.create_watir_webdriver(params)
+ require 'watir-webdriver'
+ Watir::Browser.new(params[:browser])
+ end
+
def self.create_selenium(params)
require 'selenium'
Selenium::SeleniumDriver.new(params[:server_ip],params[:server_port],'*' + params[:browser].to_s,params[:timeout])
end
@@ -44,10 +49,10 @@
browser = Watir::IE.find(:title, //)
end
browser || Watir::IE.new
end
end
-
+
# We don't know how to create the browser you asked for
class BrowserUnsupportedError < StandardError; end
end