selenium-webdriver 2.21.1 → 2.21.2.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES CHANGED
@@ -1,3 +1,13 @@
1
+ 2.21.2 (2012-04-18)
2
+ ===================
3
+
4
+ * Check MultiJson.respond_to?, depend on ~> 1.0
5
+
6
+ 2.21.1 (2012-04-16)
7
+ ===================
8
+
9
+ * Set multi_json dependency to < 1.3 to avoid deprecation warnings.
10
+
1
11
  2.21.0 (2012-04-11)
2
12
  ===================
3
13
 
@@ -63,5 +63,29 @@ module Selenium
63
63
  WebDriver::Driver.for(*args)
64
64
  end
65
65
 
66
+ if MultiJson.respond_to?(:dump)
67
+ # @api private
68
+ def self.json_dump(obj)
69
+ MultiJson.dump(obj)
70
+ end
71
+ else
72
+ # @api private
73
+ def self.json_dump(obj)
74
+ MultiJson.encode(obj)
75
+ end
76
+ end
77
+
78
+ if MultiJson.respond_to?(:load)
79
+ # @api private
80
+ def self.json_load(obj)
81
+ MultiJson.load(obj)
82
+ end
83
+ else
84
+ # @api private
85
+ def self.json_load(obj)
86
+ MultiJson.decode(obj)
87
+ end
88
+ end
89
+
66
90
  end # WebDriver
67
91
  end # Selenium
@@ -61,7 +61,7 @@ module Selenium
61
61
  prefs_file = prefs_file_for(dir)
62
62
 
63
63
  FileUtils.mkdir_p File.dirname(prefs_file)
64
- File.open(prefs_file, "w") { |file| file << MultiJson.encode(prefs) }
64
+ File.open(prefs_file, "w") { |file| file << WebDriver.json_dump(prefs) }
65
65
  end
66
66
 
67
67
  def prefs
@@ -70,7 +70,7 @@ module Selenium
70
70
 
71
71
  def read_model_prefs
72
72
  return {} unless @model
73
- MultiJson.decode File.read(prefs_file_for(@model))
73
+ WebDriver.json_load File.read(prefs_file_for(@model))
74
74
  end
75
75
 
76
76
  def prefs_file_for(dir)
@@ -28,12 +28,12 @@ module Selenium
28
28
 
29
29
  #
30
30
  # Click this element. If this causes a new page to load, this method will
31
- # attempt to block until the page has loaded. At this point, you should
32
- # discard all references to this element and any further operations
31
+ # attempt to block until the page has loaded. At this point, you should
32
+ # discard all references to this element and any further operations
33
33
  # performed on this element will raise a StaleElementReferenceError
34
34
  # unless you know that the element and the page will still be present. If
35
- # click() causes a new page to be loaded via an event or is done by
36
- # sending a native event then the method will *not* wait for it to be
35
+ # click() causes a new page to be loaded via an event or is done by
36
+ # sending a native event then the method will *not* wait for it to be
37
37
  # loaded and the caller should verify that a new page has been loaded.
38
38
  #
39
39
  # There are some preconditions for an element to be clicked. The element
@@ -49,13 +49,13 @@ module Selenium
49
49
  # @raise [StaleElementReferenceError] if the element no longer exists as
50
50
  # defined
51
51
  #
52
-
52
+
53
53
  def click
54
54
  bridge.clickElement @id
55
55
  end
56
56
 
57
57
  #
58
- # Get the tag name of the element.
58
+ # Get the tag name of the element.
59
59
  #
60
60
  # @example Get the tagname of an INPUT element(returns "input")
61
61
  #
@@ -256,7 +256,7 @@ module Selenium
256
256
  #
257
257
 
258
258
  def to_json(*args)
259
- MultiJson.encode as_json
259
+ WebDriver.json_dump as_json
260
260
  end
261
261
 
262
262
  #
@@ -19,7 +19,7 @@ module Selenium
19
19
  end
20
20
 
21
21
  def to_json(*args)
22
- MultiJson.encode as_json
22
+ WebDriver.json_dump as_json
23
23
  end
24
24
 
25
25
  private
@@ -46,7 +46,7 @@ module Selenium
46
46
 
47
47
  module ClassMethods
48
48
  def from_json(json)
49
- data = MultiJson.decode(json).fetch('zip')
49
+ data = WebDriver.json_load(json).fetch('zip')
50
50
 
51
51
  # can't use Tempfile here since it doesn't support File::BINARY mode on 1.8
52
52
  # can't use Dir.mktmpdir(&blk) because of http://jira.codehaus.org/browse/JRUBY-4082
@@ -96,7 +96,7 @@ module Selenium
96
96
  end
97
97
 
98
98
  def to_json(*args)
99
- MultiJson.encode as_json
99
+ WebDriver.json_dump as_json
100
100
  end
101
101
 
102
102
  class << self
@@ -27,7 +27,7 @@ module Selenium
27
27
  end
28
28
 
29
29
  def default_preferences
30
- @default_preferences ||= MultiJson.decode(
30
+ @default_preferences ||= WebDriver.json_load(
31
31
  File.read(File.expand_path("#{WebDriver.root}/selenium/webdriver/firefox/extension/prefs.json"))
32
32
  ).freeze
33
33
  end
@@ -241,7 +241,7 @@ module Selenium
241
241
  key, value = $1.strip, $2.strip
242
242
 
243
243
  # wrap the value in an array to make it a valid JSON string.
244
- prefs[key] = MultiJson.decode("[#{value}]").first
244
+ prefs[key] = WebDriver.json_load("[#{value}]").first
245
245
  end
246
246
  end
247
247
 
@@ -251,7 +251,7 @@ module Selenium
251
251
  def write_prefs(prefs, path)
252
252
  File.open(path, "w") { |file|
253
253
  prefs.each do |key, value|
254
- file.puts %{user_pref("#{key}", #{MultiJson.encode value});}
254
+ file.puts %{user_pref("#{key}", #{WebDriver.json_dump value});}
255
255
  end
256
256
  }
257
257
  end
@@ -223,7 +223,7 @@ module Selenium
223
223
  end
224
224
 
225
225
  def to_json(*args)
226
- MultiJson.encode as_json
226
+ WebDriver.json_dump as_json
227
227
  end
228
228
 
229
229
  def ==(other)
@@ -24,7 +24,7 @@ module Selenium
24
24
  headers['Cache-Control'] = "no-cache" if verb == :get
25
25
 
26
26
  if command_hash
27
- payload = MultiJson.encode(command_hash)
27
+ payload = WebDriver.json_dump(command_hash)
28
28
  headers["Content-Type"] = "#{CONTENT_TYPE}; charset=utf-8"
29
29
  headers["Content-Length"] = payload.bytesize.to_s if [:post, :put].include?(verb)
30
30
 
@@ -56,7 +56,7 @@ module Selenium
56
56
 
57
57
  if content_type.include? CONTENT_TYPE
58
58
  raise Error::WebDriverError, "empty body: #{content_type.inspect} (#{code})\n#{body}" if body.empty?
59
- Response.new(code, MultiJson.decode(body))
59
+ Response.new(code, WebDriver.json_load(body))
60
60
  elsif code == 204
61
61
  Response.new(code)
62
62
  else
@@ -19,7 +19,7 @@ module Selenium
19
19
  end
20
20
 
21
21
  def send(command)
22
- json = MultiJson.encode(command)
22
+ json = WebDriver.json_dump(command)
23
23
  puts ">>> #{json}" if $DEBUG
24
24
 
25
25
  frame = LibWebSocket::Frame.new(json).to_s
@@ -49,7 +49,7 @@ module Selenium
49
49
 
50
50
  puts "<<< #{msg}" if $DEBUG
51
51
 
52
- MultiJson.decode msg
52
+ WebDriver.json_load msg
53
53
  end
54
54
 
55
55
  def ws_uri
@@ -135,4 +135,4 @@ window.onload = function() {
135
135
 
136
136
  end
137
137
  end
138
- end
138
+ end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-webdriver
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 2.21.1
4
+ prerelease: 7
5
+ version: 2.21.2.rc1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jari Bakken
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-04-16 00:00:00 +01:00
13
+ date: 2012-04-18 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -19,9 +19,9 @@ dependencies:
19
19
  requirement: &id001 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
- - - <
22
+ - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: "1.3"
24
+ version: "1.0"
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
@@ -248,9 +248,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
248
248
  required_rubygems_version: !ruby/object:Gem::Requirement
249
249
  none: false
250
250
  requirements:
251
- - - ">="
251
+ - - ">"
252
252
  - !ruby/object:Gem::Version
253
- version: "0"
253
+ version: 1.3.1
254
254
  requirements: []
255
255
 
256
256
  rubyforge_project: