Sha256: 907475840aa05fe1a2a8a6bd6c8292bc7dc74d4b1d54cf301345567be9e30b0f

Contents?: true

Size: 979 Bytes

Versions: 9

Compression:

Stored size: 979 Bytes

Contents

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

require 'selenium/webdriver/remote/http/persistent'

module Sauce
  class Selenium2
    attr_reader :config, :driver

    def initialize(opts={})
      @config = Sauce::Config.new(opts)
      http_client = ::Selenium::WebDriver::Remote::Http::Persistent.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

9 entries across 9 versions & 1 rubygems

Version Path
sauce-2.3.5 lib/sauce/selenium.rb
sauce-2.3.4 lib/sauce/selenium.rb
sauce-2.3.3 lib/sauce/selenium.rb
sauce-2.3.2 lib/sauce/selenium.rb
sauce-2.2.2 lib/sauce/selenium.rb
sauce-2.2.1 lib/sauce/selenium.rb
sauce-2.2.0 lib/sauce/selenium.rb
sauce-2.1.0 lib/sauce/selenium.rb
sauce-2.0.0 lib/sauce/selenium.rb