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.



25
26
27
# File 'lib/selenium/client/protocol.rb', line 25

def session_id
  @session_id
end

Instance Method Details

#boolean_array_command(verb, args) ⇒ Object



76
77
78
# File 'lib/selenium/client/protocol.rb', line 76

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

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



72
73
74
# File 'lib/selenium/client/protocol.rb', line 72

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

#number_array_command(verb, args) ⇒ Object



68
69
70
# File 'lib/selenium/client/protocol.rb', line 68

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

#number_command(verb, args) ⇒ Object



64
65
66
# File 'lib/selenium/client/protocol.rb', line 64

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

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



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

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



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

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



35
36
37
# File 'lib/selenium/client/protocol.rb', line 35

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