Sha256: 1628f1f0fbd3fb6883a5775c1c11b6d91319e0aaeb860279f8ad5d37b96efd24

Contents?: true

Size: 1.31 KB

Versions: 25

Compression:

Stored size: 1.31 KB

Contents

module Selenium
  module WebDriver
    module PhantomJS


      # @api private
      class Bridge < Remote::Bridge

        def initialize(opts = {})
          http_client = opts.delete(:http_client)
          caps        = opts.delete(:desired_capabilities) { Remote::Capabilities.phantomjs }

          if opts.has_key?(:url)
            url = opts.delete(:url)
          else
            args = opts.delete(:args) || caps['phantomjs.cli.args']
            port = opts.delete(:port)

            @service = Service.default_service(port)
            @service.start(args)

            url = @service.uri
          end

          remote_opts = {
            :url                  => url,
            :desired_capabilities => caps
          }

          remote_opts.merge!(:http_client => http_client) if http_client

          super(remote_opts)
        end

        def browser
          :phantomjs
        end

        def driver_extensions
          [
            DriverExtensions::TakesScreenshot,
            DriverExtensions::HasInputDevices
          ]
        end

        def capabilities
          @capabilities ||= Remote::Capabilities.phantomjs
        end

        def quit
          super
        ensure
          @service.stop if @service
        end

      end # Bridge
    end # PhantomJS
  end # WebDriver
end # Selenium

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
selenium-webdriver-2.45.0 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.45.0.dev3 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.45.0.dev2 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.45.0.dev lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.44.0 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.44.0.dev lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.43.0 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.42.0 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.41.0 lib/selenium/webdriver/phantomjs/bridge.rb
browserstack-webdriver-2.40.1 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.40.0 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.40.0.rc2 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.40.0.rc1 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.39.0 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.38.0 lib/selenium/webdriver/phantomjs/bridge.rb
browserstack-webdriver-0.0.22 lib/selenium/webdriver/phantomjs/bridge.rb
browserstack-webdriver-0.0.1 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.37.0 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.35.1 lib/selenium/webdriver/phantomjs/bridge.rb
selenium-webdriver-2.35.0 lib/selenium/webdriver/phantomjs/bridge.rb