Sha256: 574a531ec5cfedf884e77362424ff4fbba36bf222717c1ab4d6932508b484be3

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

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

    def self.create_watir(params)
      require 'watir'
      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

    def self.create_selenium_webdriver(params)
      require 'selenium-webdriver'
      #Small hack. :)
      Selenium::WebDriver::Driver.class_eval do
        def goto(params)
          navigate.to params
        end
      end
      Selenium::WebDriver.for params[:browser].to_sym
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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