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.



27
28
29
# File 'lib/selenium/client/protocol.rb', line 27

def session_id
  @session_id
end

Instance Method Details

#boolean_array_command(verb, args) ⇒ Object



78
79
80
# File 'lib/selenium/client/protocol.rb', line 78

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

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



74
75
76
# File 'lib/selenium/client/protocol.rb', line 74

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

#number_array_command(verb, args) ⇒ Object



70
71
72
# File 'lib/selenium/client/protocol.rb', line 70

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

#number_command(verb, args) ⇒ Object



66
67
68
# File 'lib/selenium/client/protocol.rb', line 66

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

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



29
30
31
32
33
34
35
# File 'lib/selenium/client/protocol.rb', line 29

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



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/selenium/client/protocol.rb', line 41

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



37
38
39
# File 'lib/selenium/client/protocol.rb', line 37

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