### Home Classes Methods

### In Files

- chrome/src/rb/lib/selenium/webdriver/chrome/command_executor.rb

### Parent

Object

### Methods

- ::new
- #close
- #execute
- #port
- #uri

### 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::Chrome::CommandExecutor

@private

### Constants

HTML_TEMPLATE
JSON_TEMPLATE

### Public Class Methods

new() click to toggle source

    # File chrome/src/rb/lib/selenium/webdriver/chrome/command_executor.rb, line 10
    def initialize
      @server       = TCPServer.new(localhost, 0)
      @queue        = Queue.new

      @accepted_any = false
      @next_socket  = nil
      @listening    = true

      Thread.new { start_run_loop }
    end

### Public Instance Methods

close() click to toggle source

    # File chrome/src/rb/lib/selenium/webdriver/chrome/command_executor.rb, line 36
    def close
      stop_listening
      close_sockets
      @server.close unless @server.closed?
    rescue IOError
      nil
    end

execute(command) click to toggle source

    # File chrome/src/rb/lib/selenium/webdriver/chrome/command_executor.rb, line 21
    def execute(command)
      until accepted_any?
        Thread.pass
        sleep 0.01
      end

      json = command.to_json
      data = JSON_TEMPLATE % [json.length, json]

      @next_socket.write data
      @next_socket.close

      JSON.parse read_response(@queue.pop)
    end

port() click to toggle source

    # File chrome/src/rb/lib/selenium/webdriver/chrome/command_executor.rb, line 44
    def port
      @server.addr[1]
    end

uri() click to toggle source

    # File chrome/src/rb/lib/selenium/webdriver/chrome/command_executor.rb, line 48
    def uri
      "http://localhost:#{port}/chromeCommandExecutor"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.