### Home Classes Methods

### In Files

- remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb
- remote/client/src/rb/lib/selenium/webdriver/remote/commands.rb

### Parent

Object

### Methods

- ::command
- ::new
- #addCookie
- #browser
- #clearElement
- #clickElement
- #close
- #create_session
- #deleteAllCookies
- #deleteCookie
- #dragElement
- #driver_extensions
- #executeScript
- #findElementByClassName
- #findElementById
- #findElementByLinkText
- #findElementByName
- #findElementByPartialLinkText
- #findElementByTagName
- #findElementByXpath
- #findElementsByClassName
- #findElementsById
- #findElementsByLinkText
- #findElementsByName
- #findElementsByPartialLinkText
- #findElementsByTagName
- #findElementsByXpath
- #get
- #getActiveElement
- #getAllCookies
- #getCapabilities
- #getCurrentUrl
- #getCurrentWindowHandle
- #getElementAttribute
- #getElementLocation
- #getElementSize
- #getElementTagName
- #getElementText
- #getElementValue
- #getElementValueOfCssProperty
- #getPageSource
- #getSpeed
- #getTitle
- #getVisible
- #getWindowHandles
- #goBack
- #goForward
- #hoverOverElement
- #isElementDisplayed
- #isElementEnabled
- #isElementSelected
- #quit
- #refresh
- #sendKeysToElement
- #session_id
- #setElementSelected
- #setImplicitWaitTimeout
- #setSpeed
- #setVisible
- #submitElement
- #switchToActiveElement
- #switchToDefaultContent
- #switchToFrame
- #switchToWindow
- #toggleElement

### Included Modules

- Selenium::WebDriver::Find
- Selenium::WebDriver::BridgeHelper

### Class/Module Index

Quicksearch

- Selenium
- Selenium::WebDriver
- Selenium::WebDriver::BridgeHelper
- Selenium::WebDriver::ChildProcess
- Selenium::WebDriver::ChildProcess::IronRubyProcess
- Selenium::WebDriver::ChildProcess::JRubyProcess
- Selenium::WebDriver::ChildProcess::WindowsProcess
- Selenium::WebDriver::Chrome
- Selenium::WebDriver::Chrome::Bridge
- Selenium::WebDriver::Chrome::CommandExecutor
- Selenium::WebDriver::Chrome::Launcher
- Selenium::WebDriver::Chrome::Launcher::MacOSXLauncher
- Selenium::WebDriver::Chrome::Launcher::UnixLauncher
- Selenium::WebDriver::Chrome::Launcher::WindowsLauncher
- Selenium::WebDriver::Driver
- Selenium::WebDriver::DriverExtensions
- Selenium::WebDriver::DriverExtensions::TakesScreenshot
- Selenium::WebDriver::Element
- Selenium::WebDriver::Error
- Selenium::WebDriver::Error::ElementNotDisplayedError
- Selenium::WebDriver::Error::ElementNotEnabledError
- Selenium::WebDriver::Error::ElementNotSelectableError
- Selenium::WebDriver::Error::ExpectedError
- Selenium::WebDriver::Error::IndexOutOfBoundsError
- Selenium::WebDriver::Error::InvalidCookieDomainError
- Selenium::WebDriver::Error::NoCollectionError
- Selenium::WebDriver::Error::NoScriptResultError
- Selenium::WebDriver::Error::NoStringError
- Selenium::WebDriver::Error::NoStringLengthError
- Selenium::WebDriver::Error::NoStringWrapperError
- Selenium::WebDriver::Error::NoSuchCollectionError
- Selenium::WebDriver::Error::NoSuchDocumentError
- Selenium::WebDriver::Error::NoSuchDriverError
- Selenium::WebDriver::Error::NoSuchElementError
- Selenium::WebDriver::Error::NoSuchFrameError
- Selenium::WebDriver::Error::NoSuchWindowError
- Selenium::WebDriver::Error::NullPointerError
- Selenium::WebDriver::Error::ObsoleteElementError
- Selenium::WebDriver::Error::ServerError
- Selenium::WebDriver::Error::TimeOutError
- Selenium::WebDriver::Error::UnableToSetCookieError
- Selenium::WebDriver::Error::UnexpectedJavascriptError
- Selenium::WebDriver::Error::UnhandledError
- Selenium::WebDriver::Error::UnknownCommandError
- Selenium::WebDriver::Error::UnknownScriptResultError
- Selenium::WebDriver::Error::UnsupportedOperationError
- Selenium::WebDriver::Error::WebDriverError
- Selenium::WebDriver::FileReaper
- Selenium::WebDriver::Find
- Selenium::WebDriver::Firefox
- Selenium::WebDriver::Firefox::Binary
- Selenium::WebDriver::Firefox::Bridge
- Selenium::WebDriver::Firefox::Launcher
- Selenium::WebDriver::Firefox::Profile
- Selenium::WebDriver::Firefox::ProfilesIni
- Selenium::WebDriver::Firefox::Util
- Selenium::WebDriver::IE
- Selenium::WebDriver::IE::Bridge
- Selenium::WebDriver::IE::Kernel32
- Selenium::WebDriver::IE::Lib
- Selenium::WebDriver::IE::Util
- Selenium::WebDriver::Keys
- Selenium::WebDriver::Navigation
- Selenium::WebDriver::Options
- Selenium::WebDriver::Platform
- Selenium::WebDriver::Remote
- Selenium::WebDriver::Remote::Bridge
- Selenium::WebDriver::Remote::Capabilities
- Selenium::WebDriver::Remote::Http
- Selenium::WebDriver::Remote::Http::Common
- Selenium::WebDriver::Remote::Http::Curb
- Selenium::WebDriver::Remote::Http::Default
- Selenium::WebDriver::Remote::Response
- Selenium::WebDriver::TargetLocator
- Selenium::WebDriver::Timeouts
- Dir
- SocketError
- String

No matching classes.

# Selenium::WebDriver::Remote::Bridge

Low level bridge to the remote server, through which the rest of the API works.

@private

@private

### Constants

QUIT_ERRORS

### Attributes

capabilities[R]
context[RW]
http[RW]

### Public Class Methods

command(name, verb, url) click to toggle source

Defines a wrapper method for a command, which ultimately calls execute.

@param name [Symbol]

    name of the resulting method

@param url [String]

    a URL template, which can include some arguments, much like the definitions on the server.
    the :session_id parameter is implicitly handled, but the remainder will become required method arguments.

@param verb [Symbol]

    the appropriate http verb, such as :get, :post, or :delete

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 29
    def self.command(name, verb, url)
      COMMANDS[name] = [verb, url.freeze]
    end

new(opts = {}) click to toggle source

Initializes the bridge with the given server URL.

@param url [String] url for the remote server @param http_client [Class] an HTTP client class that implements the same interface as DefaultHttpClient @param desired_capabilities [Capabilities] an instance of Remote::Capabilities describing the capabilities you want

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 44
    def initialize(opts = {})
      opts                 = default_options.merge(opts)
      http_client_class    = opts.delete(:http_client)
      desired_capabilities = opts.delete(:desired_capabilities)
      url                  = opts.delete(:url)

      unless opts.empty?
        raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
      end

      if desired_capabilities.kind_of?(Symbol)
        unless Capabilities.respond_to?(desired_capabilities)
          raise Error::WebDriverError, "invalid desired capability: #{desired_capabilities.inspect}"
        end

        desired_capabilities = Capabilities.send(desired_capabilities)
      end

      uri = URI.parse(url)
      uri.path += "/" unless uri.path =~ /\/$/

      @http         = http_client_class.new uri
      @capabilities = create_session(desired_capabilities)
    end

### Public Instance Methods

addCookie(cookie) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 184
    def addCookie(cookie)
      execute :addCookie, {}, :cookie => cookie
    end

browser() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 69
    def browser
      @browser ||= @capabilities.browser_name.gsub(" ", "_").to_sym
    end

clearElement(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 297
    def clearElement(element)
      execute :clearElement, :id => element
    end

clickElement(element) click to toggle source

Element functions

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 261
    def clickElement(element)
      execute :clickElement, :id => element
    end

close() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 151
    def close
      execute :close
    end

create_session(desired_capabilities) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 85
    def create_session(desired_capabilities)
      resp = raw_execute :newSession, {}, :desiredCapabilities => desired_capabilities
      @session_id = resp['sessionId'] || raise(Error::WebDriverError, 'no sessionId in returned payload')

      Capabilities.json_create resp['value']
    end

deleteAllCookies() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 196
    def deleteAllCookies
      execute :deleteAllCookies
    end

deleteCookie(name) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 188
    def deleteCookie(name)
      execute :deleteCookieNamed, :name => name
    end

dragElement(element, rigth_by, down_by) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 338
    def dragElement(element, rigth_by, down_by)
      execute :dragElement, {:id => element}, :x => rigth_by, :y => down_by
    end

driver_extensions() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 73
    def driver_extensions
      []
    end

executeScript(script, *args) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 175
    def executeScript(script, *args)
      unless capabilities.javascript?
        raise Error::UnsupportedOperationError, "underlying webdriver instance does not support javascript"
      end

      result = execute :executeScript, {}, :script => script, :args => args
      unwrap_script_result result
    end

findElementByClassName(parent, class_name) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 200
    def findElementByClassName(parent, class_name)
      find_element_by 'class name', class_name, parent
    end

findElementById(parent, id) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 208
    def findElementById(parent, id)
      find_element_by 'id', id, parent
    end

findElementByLinkText(parent, link_text) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 216
    def findElementByLinkText(parent, link_text)
      find_element_by 'link text', link_text, parent
    end

findElementByName(parent, name) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 232
    def findElementByName(parent, name)
      find_element_by 'name', name, parent
    end

findElementByPartialLinkText(parent, link_text) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 224
    def findElementByPartialLinkText(parent, link_text)
      find_element_by 'partial link text', link_text, parent
    end

findElementByTagName(parent, tag_name) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 240
    def findElementByTagName(parent, tag_name)
      find_element_by 'tag name', tag_name, parent
    end

findElementByXpath(parent, xpath) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 248
    def findElementByXpath(parent, xpath)
      find_element_by 'xpath', xpath, parent
    end

findElementsByClassName(parent, class_name) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 204
    def findElementsByClassName(parent, class_name)
      find_elements_by 'class name', class_name, parent
    end

findElementsById(parent, id) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 212
    def findElementsById(parent, id)
      find_elements_by 'id', id, parent
    end

findElementsByLinkText(parent, link_text) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 220
    def findElementsByLinkText(parent, link_text)
      find_elements_by 'link text', link_text, parent
    end

findElementsByName(parent, name) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 236
    def findElementsByName(parent, name)
      find_elements_by 'name', name, parent
    end

findElementsByPartialLinkText(parent, link_text) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 228
    def findElementsByPartialLinkText(parent, link_text)
      find_elements_by 'partial link text', link_text, parent
    end

findElementsByTagName(parent, tag_name) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 244
    def findElementsByTagName(parent, tag_name)
      find_elements_by 'tag name', tag_name, parent
    end

findElementsByXpath(parent, xpath) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 252
    def findElementsByXpath(parent, xpath)
      find_elements_by 'xpath', xpath, parent
    end

get(url) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 92
    def get(url)
      execute :get, {}, :url => url
    end

getActiveElement() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 329
    def getActiveElement
      Element.new self, element_id_from(execute(:getActiveElement))
    end

Also aliased as: switchToActiveElement
getAllCookies() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 192
    def getAllCookies
      execute :getAllCookies
    end

getCapabilities() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 96
    def getCapabilities
      Capabilities.json_create execute(:getCapabilities)
    end

getCurrentUrl() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 112
    def getCurrentUrl
      execute :getCurrentUrl
    end

getCurrentWindowHandle() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 163
    def getCurrentWindowHandle
      execute :getCurrentWindowHandle
    end

getElementAttribute(element, name) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 269
    def getElementAttribute(element, name)
      execute :getElementAttribute, :id => element, :name => name
    end

getElementLocation(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 281
    def getElementLocation(element)
      data = execute :getElementLocation, :id => element

      Point.new data['x'], data['y']
    end

getElementSize(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 287
    def getElementSize(element)
      data = execute :getElementSize, :id => element

      Dimension.new data['width'], data['height']
    end

getElementTagName(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 265
    def getElementTagName(element)
      execute :getElementTagName, :id => element
    end

getElementText(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 277
    def getElementText(element)
      execute :getElementText, :id => element
    end

getElementValue(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 273
    def getElementValue(element)
      execute :getElementValue, :id => element
    end

getElementValueOfCssProperty(element, prop) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 325
    def getElementValueOfCssProperty(element, prop)
      execute :getElementValueOfCssProperty, :id => element, :property_name => prop
    end

getPageSource() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 120
    def getPageSource
      execute :getPageSource
    end

getSpeed() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 171
    def getSpeed
      execute :getSpeed
    end

getTitle() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 116
    def getTitle
      execute :getTitle
    end

getVisible() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 124
    def getVisible
      execute :getVisible
    end

getWindowHandles() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 159
    def getWindowHandles
      execute :getWindowHandles
    end

goBack() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 104
    def goBack
      execute :goBack
    end

goForward() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 108
    def goForward
      execute :goForward
    end

hoverOverElement(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 334
    def hoverOverElement(element)
      execute :hoverOverElement, :id => element
    end

isElementDisplayed(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 309
    def isElementDisplayed(element)
      execute :isElementDisplayed, :id => element
    end

isElementEnabled(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 301
    def isElementEnabled(element)
      execute :isElementEnabled, :id => element
    end

isElementSelected(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 305
    def isElementSelected(element)
      execute :isElementSelected, :id => element
    end

quit() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 146
    def quit
      execute :quit
    rescue *QUIT_ERRORS
    end

refresh() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 155
    def refresh
      execute :refresh
    end

sendKeysToElement(element, string) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 293
    def sendKeysToElement(element, string)
      execute :sendKeysToElement, {:id => element}, {:value => string.split(//)}
    end

session_id() click to toggle source

Returns the current session ID.

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 81
    def session_id
      @session_id || raise(Error::WebDriverError, "no current session exists")
    end

setElementSelected(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 321
    def setElementSelected(element)
      execute :setElementSelected, :id => element
    end

setImplicitWaitTimeout(milliseconds) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 100
    def setImplicitWaitTimeout(milliseconds)
      execute :setImplicitWaitTimeout, {}, :ms => milliseconds
    end

setSpeed(value) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 167
    def setSpeed(value)
      execute :setSpeed, {}, :speed => value
    end

setVisible(bool) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 128
    def setVisible(bool)
      execute :setVisible, {}, bool
    end

submitElement(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 313
    def submitElement(element)
      execute :submitElement, :id => element
    end

switchToActiveElement() click to toggle source
Alias for: getActiveElement
switchToDefaultContent() click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 140
    def switchToDefaultContent
      execute :switchToFrame, {}, :id => nil
    end

switchToFrame(id) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 136
    def switchToFrame(id)
      execute :switchToFrame, {}, :id => id
    end

switchToWindow(name) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 132
    def switchToWindow(name)
      execute :switchToWindow, {}, :name => name
    end

toggleElement(element) click to toggle source

    # File remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb, line 317
    def toggleElement(element)
      execute :toggleElement, :id => element
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.