Parent

Class/Module Index [+]

Quicksearch

Selenium::WebDriver::Chrome::CommandExecutor

@private

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.