Sha256: aecf3a5cf4027d84a4d89de5271749a8c1ae1f0afb0e777bcb88c31dbb873fe9

Contents?: true

Size: 1003 Bytes

Versions: 1

Compression:

Stored size: 1003 Bytes

Contents

require 'taza/browsers/ie_watir'
require 'taza/browsers/safari_watir'

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


    private    

    def self.create_watir(params)
      method = "create_watir_#{params[:browser]}"
      raise BrowserUnsupportedError unless self.respond_to?(method)
      watir = self.send(method)
      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.create_watir_firefox
      require 'firewatir'
      FireWatir::Firefox.new()
    end
        
  end
end

class BrowserUnsupportedError < StandardError
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
taza-0.8.0 lib/taza/browser.rb