Module: Selenium::Client::Protocol

Included in:
Base
Defined in:
lib/selenium/client/protocol.rb

Overview

Module in charge of handling Selenium over-the-wire HTTP protocol

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#session_idObject (readonly)

Returns the value of attribute session_id



8
9
10
# File 'lib/selenium/client/protocol.rb', line 8

def session_id
  @session_id
end

Instance Method Details

#boolean_array_command(verb, args) ⇒ Object



59
60
61
# File 'lib/selenium/client/protocol.rb', line 59

def boolean_array_command(verb, args)
  string_array_command(verb, args).collect {|value| parse_boolean_value(value)}
end

#boolean_command(verb, args = []) ⇒ Object



55
56
57
# File 'lib/selenium/client/protocol.rb', line 55

def boolean_command(verb, args=[])
  parse_boolean_value string_command(verb, args)
end

#number_array_command(verb, args) ⇒ Object



51
52
53
# File 'lib/selenium/client/protocol.rb', line 51

def number_array_command(verb, args)
  string_array_command verb, args
end

#number_command(verb, args) ⇒ Object



47
48
49
# File 'lib/selenium/client/protocol.rb', line 47

def number_command(verb, args)
  string_command verb, args
end

#remote_control_command(verb, args = []) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/selenium/client/protocol.rb', line 10

def remote_control_command(verb, args=[])
  timeout(@default_timeout_in_seconds) do
    status, response = http_post(http_request_for(verb, args))
    raise CommandError, response unless status == "OK"
    response[3..-1] # strip "OK," from response
  end
end

#string_array_command(verb, args = []) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/selenium/client/protocol.rb', line 22

def string_array_command(verb, args=[])
  csv = string_command(verb, args)
  token = ""
  tokens = []
  escape = false
  csv.split(//).each do |letter|
    if escape
      token += letter
      escape = false
      next
    end
    case letter
      when '\\'
        escape = true
      when ','
        tokens << token
        token = ""
      else
        token += letter
    end
  end
  tokens << token
  return tokens
end

#string_command(verb, args = []) ⇒ Object



18
19
20
# File 'lib/selenium/client/protocol.rb', line 18

def string_command(verb, args=[])
  remote_control_command(verb, args)
end