Sha256: 15c6f363e5b5f69a10406ff7622694d5fee16505aaba258368ee085d347f91fe

Contents?: true

Size: 847 Bytes

Versions: 6

Compression:

Stored size: 847 Bytes

Contents

module Selenium
  module WebDriver
    module Error
      class ServerError < StandardError

        def initialize(response)
          return super(response) if response.kind_of?(String)

          if response.respond_to?(:error) && err = response.error
            super(err["message"] || err['class'])
          else
            super("status code #{response.code}")
          end
        end

      end

      REMOTE_EXCEPTIONS = {
        'org.openqa.selenium.NoSuchElementException' => NoSuchElementError,
        'org.openqa.selenium.NoSuchFrameException'   => NoSuchFrameError,
        'org.openqa.selenium.NoSuchWindowException'  => NoSuchWindowError,
      }

      class << self
        def for_remote_class(klass)
          REMOTE_EXCEPTIONS[klass] || ServerError
        end
      end

    end # Error
  end # WebDriver
end # Selenium

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
rainux-selenium-webdriver-0.0.17 remote/client/src/rb/lib/selenium/webdriver/remote/server_error.rb
selenium-webdriver-0.0.17 remote/client/src/rb/lib/selenium/webdriver/remote/server_error.rb
selenium-webdriver-0.0.16 remote/client/src/rb/lib/selenium/webdriver/remote/server_error.rb
selenium-webdriver-0.0.15 remote/client/src/rb/lib/selenium/webdriver/remote/server_error.rb
selenium-webdriver-0.0.14 remote/client/src/rb/lib/selenium/webdriver/remote/server_error.rb
selenium-webdriver-0.0.13 remote/client/src/rb/lib/selenium/webdriver/remote/server_error.rb