Sha256: 315129dc65e9607c496af367e2fc0e9f4bb46c99c0ecb56c297e36ad4400d875

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require "selenium/client"
require "selenium/webdriver"

module Sauce
  class Selenium < ::Selenium::Client::Driver
    def initialize(opts={})
      @config = Sauce::Config.new(opts)
      super(opts.merge({:host => @config.host, :port => @config.port,
           :browser => @config.to_browser_string, :url => @config.browser_url}))
    end
  end

  class Selenium2
    def initialize(opts={})
      @config = Sauce::Config.new(opts)
      http_client = ::Selenium::WebDriver::Remote::Http::Default.new
      http_client.timeout = 300 # Browser launch can take a while
      @driver = ::Selenium::WebDriver.for(:remote, :url => "http://#{@config.username}:#{@config.access_key}@#{@config.host}:#{@config.port}/wd/hub", :desired_capabilities => @config.to_desired_capabilities, :http_client => http_client)
      http_client.timeout = 90 # Once the browser is up, commands should time out reasonably
    end

    def method_missing(meth, *args)
      @driver.send(meth, *args)
    end

    def session_id
      @driver.send(:bridge).session_id
    end

    def stop
      @driver.quit
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sauce-0.18.3 lib/sauce/selenium.rb
sauce-0.18.2 lib/sauce/selenium.rb
sauce-0.18.1 lib/sauce/selenium.rb
sauce-0.18.0 lib/sauce/selenium.rb
sauce-0.17.8 lib/sauce/selenium.rb