selenium-webdriver 2.35.1 → 2.37.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,26 @@
1
+ 2.37.0 (2013-10-18)
2
+ ===================
3
+
4
+ * As of this version, selenium-webdriver no longer supports Ruby < 1.9.2
5
+ * Depend on rubyzip ~> 1.0.0
6
+ * Added SOCKS proxy support
7
+ * Fixed support for SVG documents in the atoms.
8
+ * Fixed computing an element's container dimensions to account for the scrollbar size when scrolling
9
+ * Added Capabilities.htmlunitwithjs
10
+
11
+ Chrome:
12
+ * Pass through the prefs option as a Chrome capability (#5929).
13
+ Firefox:
14
+ * Updated Firefox native event components to support Firefox 24.
15
+ * New elementScrollBehavior capability.
16
+ * Fixed getLocation to work on scrolled pages.
17
+ * Fixed autoscrolling for elements located in frames.
18
+ * Fixed drag-n-drop for elements in frames with native events
19
+ IE:
20
+ * Use native events by default, also for remote IE (#4695)
21
+ Safari:
22
+ * Enable screenshots and input devices in the client.
23
+
1
24
  2.35.1 (2013-08-26)
2
25
  ===================
3
26
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # selenium-webdriver
2
2
 
3
- This gem provides Ruby bindings for WebDriver and has been tested to work on MRI (1.8.7 through 2.0), JRuby and Rubinius.
3
+ This gem provides Ruby bindings for WebDriver and has been tested to work on MRI (1.9.2 through 2.1), JRuby and Rubinius.
4
4
 
5
5
  ## Install
6
6
 
@@ -61,6 +61,7 @@ module Selenium
61
61
  detach = opts.delete(:detach)
62
62
  proxy = opts.delete(:proxy)
63
63
  no_website_testing_defaults = opts.delete(:no_website_testing_defaults)
64
+ prefs = opts.delete(:prefs)
64
65
 
65
66
  unless opts.empty?
66
67
  raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
@@ -89,13 +90,14 @@ module Selenium
89
90
  chrome_options['verbose'] = true if verbose
90
91
  chrome_options['detach'] = detach.nil? || !!detach
91
92
  chrome_options['noWebsiteTestingDefaults'] = true if no_website_testing_defaults
93
+ chrome_options['prefs'] = prefs if prefs
92
94
 
93
95
  caps['chromeOptions'] = chrome_options
94
96
  caps['proxy'] = proxy if proxy
95
97
 
96
98
  # legacy options - for chromedriver < 17.0.963.0
97
99
  caps["chrome.switches"] = chrome_options['args'] if chrome_options.member?('args')
98
- %w[binary detach extensions nativeEvents noWebsiteTestingDefaults profile verbose].each do |key|
100
+ %w[binary detach extensions nativeEvents noWebsiteTestingDefaults prefs profile verbose].each do |key|
99
101
  caps["chrome.#{key}"] = chrome_options[key] if chrome_options.member?(key)
100
102
  end
101
103
 
@@ -47,15 +47,13 @@ module Selenium
47
47
  #
48
48
 
49
49
  def move_to(element, right_by = nil, down_by = nil)
50
- unless element.kind_of? Element
51
- raise TypeError, "expected #{Element}, got #{element.inspect}:#{element.class}"
52
- end
50
+ assert_element element
53
51
 
54
52
  @bridge.mouseMoveTo element.ref, right_by, down_by
55
53
  end
56
54
 
57
55
  def move_by(right_by, down_by)
58
- @bridge.mouseMoveTo nil, right_by, down_by
56
+ @bridge.mouseMoveTo nil, Integer(right_by), Integer(down_by)
59
57
  end
60
58
 
61
59
  private
@@ -64,6 +62,11 @@ module Selenium
64
62
  move_to element if element
65
63
  end
66
64
 
65
+ def assert_element(element)
66
+ unless element.kind_of? Element
67
+ raise TypeError, "expected #{Element}, got #{element.inspect}:#{element.class}"
68
+ end
69
+ end
67
70
  end # Mouse
68
71
  end # WebDriver
69
72
  end # Selenium
@@ -12,6 +12,9 @@ module Selenium
12
12
  attr_reader :type,
13
13
  :ftp,
14
14
  :http,
15
+ :socks,
16
+ :socks_username,
17
+ :socks_password,
15
18
  :no_proxy,
16
19
  :pac,
17
20
  :ssl,
@@ -20,13 +23,16 @@ module Selenium
20
23
  def initialize(opts = {})
21
24
  opts = opts.dup
22
25
 
23
- self.type = opts.delete(:type) if opts.has_key? :type
24
- self.ftp = opts.delete(:ftp) if opts.has_key? :ftp
25
- self.http = opts.delete(:http) if opts.has_key? :http
26
- self.no_proxy = opts.delete(:no_proxy) if opts.has_key? :no_proxy
27
- self.ssl = opts.delete(:ssl) if opts.has_key? :ssl
28
- self.pac = opts.delete(:pac) if opts.has_key? :pac
29
- self.auto_detect = opts.delete(:auto_detect) if opts.has_key? :auto_detect
26
+ self.type = opts.delete(:type) if opts.has_key? :type
27
+ self.ftp = opts.delete(:ftp) if opts.has_key? :ftp
28
+ self.http = opts.delete(:http) if opts.has_key? :http
29
+ self.no_proxy = opts.delete(:no_proxy) if opts.has_key? :no_proxy
30
+ self.ssl = opts.delete(:ssl) if opts.has_key? :ssl
31
+ self.pac = opts.delete(:pac) if opts.has_key? :pac
32
+ self.auto_detect = opts.delete(:auto_detect) if opts.has_key? :auto_detect
33
+ self.socks = opts.delete(:socks) if opts.has_key? :socks
34
+ self.socks_username = opts.delete(:socks_username) if opts.has_key? :socks_username
35
+ self.socks_password = opts.delete(:socks_password) if opts.has_key? :socks_password
30
36
 
31
37
  unless opts.empty?
32
38
  raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
@@ -68,6 +74,21 @@ module Selenium
68
74
  @auto_detect = bool
69
75
  end
70
76
 
77
+ def socks=(value)
78
+ self.type = :manual
79
+ @socks = value
80
+ end
81
+
82
+ def socks_username=(value)
83
+ self.type = :manual
84
+ @socks_username = value
85
+ end
86
+
87
+ def socks_password=(value)
88
+ self.type = :manual
89
+ @socks_password = value
90
+ end
91
+
71
92
  def type=(type)
72
93
  unless TYPES.has_key? type
73
94
  raise ArgumentError, "invalid proxy type: #{type.inspect}, expected one of #{TYPES.keys.inspect}"
@@ -91,6 +112,9 @@ module Selenium
91
112
  json_result["proxyAutoconfigUrl"] = pac if pac
92
113
  json_result["sslProxy"] = ssl if ssl
93
114
  json_result["autodetect"] = auto_detect if auto_detect
115
+ json_result["socksProxy"] = socks if socks
116
+ json_result["socksUsername"] = socks_username if socks_username
117
+ json_result["socksPassword"] = socks_password if socks_password
94
118
 
95
119
  json_result if json_result.length > 1
96
120
  end
@@ -105,13 +129,16 @@ module Selenium
105
129
 
106
130
  proxy = new
107
131
 
108
- proxy.type = data['proxyType'].downcase.to_sym if data.has_key? 'proxyType'
109
- proxy.ftp = data['ftpProxy'] if data.has_key? 'ftpProxy'
110
- proxy.http = data['httpProxy'] if data.has_key? 'httpProxy'
111
- proxy.no_proxy = data['noProxy'] if data.has_key? 'noProxy'
112
- proxy.pac = data['proxyAutoconfigUrl'] if data.has_key? 'proxyAutoconfigUrl'
113
- proxy.ssl = data['sslProxy'] if data.has_key? 'sslProxy'
114
- proxy.auto_detect = data['autodetect'] if data.has_key? 'autodetect'
132
+ proxy.type = data['proxyType'].downcase.to_sym if data.has_key? 'proxyType'
133
+ proxy.ftp = data['ftpProxy'] if data.has_key? 'ftpProxy'
134
+ proxy.http = data['httpProxy'] if data.has_key? 'httpProxy'
135
+ proxy.no_proxy = data['noProxy'] if data.has_key? 'noProxy'
136
+ proxy.pac = data['proxyAutoconfigUrl'] if data.has_key? 'proxyAutoconfigUrl'
137
+ proxy.ssl = data['sslProxy'] if data.has_key? 'sslProxy'
138
+ proxy.auto_detect = data['autodetect'] if data.has_key? 'autodetect'
139
+ proxy.socks = data['socksProxy'] if data.has_key? 'socksProxy'
140
+ proxy.socks_username = data['socksUsername'] if data.has_key? 'socksUsername'
141
+ proxy.socks_password = data['socksPassword'] if data.has_key? 'socksPassword'
115
142
 
116
143
  proxy
117
144
  end
@@ -45,8 +45,8 @@ module Selenium
45
45
  def scroll(*args)
46
46
  case args.size
47
47
  when 2
48
- x, y = args
49
- @bridge.touchScroll nil, x, y
48
+ x_offset, y_offset = args
49
+ @bridge.touchScroll nil, Integer(x_offset), Integer(y_offset)
50
50
  when 3
51
51
  element, x_offset, y_offset = args
52
52
  assert_element element
@@ -1,4 +1,4 @@
1
- require 'zip/zip'
1
+ require 'zip'
2
2
  require 'tempfile'
3
3
  require 'find'
4
4
 
@@ -18,7 +18,7 @@ module Selenium
18
18
  destination = Dir.mktmpdir("webdriver-unzip")
19
19
  FileReaper << destination
20
20
 
21
- Zip::ZipFile.open(path) do |zip|
21
+ Zip::File.open(path) do |zip|
22
22
  zip.each do |entry|
23
23
  to = File.join(destination, entry.name)
24
24
  dirname = File.dirname(to)
@@ -62,7 +62,7 @@ module Selenium
62
62
  zip_path = File.join(tmp_dir, "webdriver-zip")
63
63
 
64
64
  begin
65
- Zip::ZipFile.open(zip_path, Zip::ZipFile::CREATE, &blk)
65
+ Zip::File.open(zip_path, Zip::File::CREATE, &blk)
66
66
  ensure
67
67
  FileUtils.rm_rf tmp_dir
68
68
  FileUtils.rm_rf zip_path
@@ -70,7 +70,7 @@ module Selenium
70
70
  end
71
71
 
72
72
  def add_zip_entry(zip, file, entry_name)
73
- entry = Zip::ZipEntry.new(zip.name, entry_name)
73
+ entry = Zip::Entry.new(zip.name, entry_name)
74
74
  entry.follow_symlinks = true
75
75
 
76
76
  zip.add entry, file
@@ -156,6 +156,7 @@ module Selenium
156
156
  set_manual_proxy_preference "ftp", proxy.ftp
157
157
  set_manual_proxy_preference "http", proxy.http
158
158
  set_manual_proxy_preference "ssl", proxy.ssl
159
+ set_manual_proxy_preference "socks", proxy.socks
159
160
 
160
161
  if proxy.no_proxy
161
162
  self["network.proxy.no_proxies_on"] = proxy.no_proxy
@@ -458,11 +458,11 @@ module Selenium
458
458
 
459
459
  def touchScroll(element, x, y)
460
460
  if element
461
- execute :touchScroll, {}, :xoffset => x, :yoffset => y
462
- else
463
461
  execute :touchScroll, {}, :element => element,
464
462
  :xoffset => x,
465
463
  :yoffset => y
464
+ else
465
+ execute :touchScroll, {}, :xoffset => x, :yoffset => y
466
466
  end
467
467
  end
468
468
 
@@ -73,12 +73,20 @@ module Selenium
73
73
  }.merge(opts))
74
74
  end
75
75
 
76
+ def htmlunitwithjs(opts = {})
77
+ new({
78
+ :browser_name => "htmlunit",
79
+ :javascript_enabled => true
80
+ }.merge(opts))
81
+ end
82
+
76
83
  def internet_explorer(opts = {})
77
84
  new({
78
85
  :browser_name => "internet explorer",
79
86
  :platform => :windows,
80
87
  :takes_screenshot => true,
81
- :css_selectors_enabled => true
88
+ :css_selectors_enabled => true,
89
+ :native_events => true
82
90
  }.merge(opts))
83
91
  end
84
92
  alias_method :ie, :internet_explorer
@@ -185,7 +193,7 @@ module Selenium
185
193
  end
186
194
 
187
195
  def merge!(other)
188
- if other.respond_to?(:capabilities) && other.capabilities.kind_of?(Hash)
196
+ if other.respond_to?(:capabilities, true) && other.capabilities.kind_of?(Hash)
189
197
  @capabilities.merge! other.capabilities
190
198
  elsif other.kind_of? Hash
191
199
  @capabilities.merge! other
@@ -119,7 +119,7 @@ module Selenium
119
119
  host == server_url.host || (
120
120
  begin
121
121
  IPAddr.new(host).include?(server_url.host)
122
- rescue ArgumentError
122
+ rescue ArgumentError => ex
123
123
  false
124
124
  end
125
125
  )
@@ -38,7 +38,10 @@ module Selenium
38
38
  end
39
39
 
40
40
  def driver_extensions
41
- []
41
+ [
42
+ DriverExtensions::TakesScreenshot,
43
+ DriverExtensions::HasInputDevices
44
+ ]
42
45
  end
43
46
 
44
47
  private
@@ -94,7 +94,7 @@ module Selenium
94
94
  data_dir = Pathname.new(@custom_data_dir || safari_data_dir)
95
95
 
96
96
  unless data_dir.exist? && data_dir.directory?
97
- raise Errno::ENOENT, "Safari data directory not found at #{dir.to_s}"
97
+ raise Errno::ENOENT, "Safari data directory not found at #{data_dir.to_s}"
98
98
  end
99
99
 
100
100
  data_dir.join('Extensions')
@@ -3746,7 +3746,7 @@ goog.dom.getDocumentScrollElement = function() {
3746
3746
  return goog.dom.getDocumentScrollElement_(document)
3747
3747
  };
3748
3748
  goog.dom.getDocumentScrollElement_ = function(a) {
3749
- return!goog.userAgent.WEBKIT && goog.dom.isCss1CompatMode_(a) ? a.documentElement : a.body
3749
+ return!goog.userAgent.WEBKIT && goog.dom.isCss1CompatMode_(a) ? a.documentElement : a.body || a.documentElement
3750
3750
  };
3751
3751
  goog.dom.getWindow = function(a) {
3752
3752
  return a ? goog.dom.getWindow_(a) : window
@@ -4672,7 +4672,7 @@ goog.style.getBoundingClientRect_ = function(a) {
4672
4672
  }catch(c) {
4673
4673
  return{left:0, top:0, right:0, bottom:0}
4674
4674
  }
4675
- goog.userAgent.IE && (a = a.ownerDocument, b.left -= a.documentElement.clientLeft + a.body.clientLeft, b.top -= a.documentElement.clientTop + a.body.clientTop);
4675
+ goog.userAgent.IE && a.ownerDocument.body && (a = a.ownerDocument, b.left -= a.documentElement.clientLeft + a.body.clientLeft, b.top -= a.documentElement.clientTop + a.body.clientTop);
4676
4676
  return b
4677
4677
  };
4678
4678
  goog.style.getOffsetParent = function(a) {
@@ -5041,7 +5041,7 @@ goog.style.getIePixelBorder_ = function(a, b) {
5041
5041
  return c in goog.style.ieBorderWidthKeywords_ ? goog.style.ieBorderWidthKeywords_[c] : goog.style.getIePixelValue_(a, c, "left", "pixelLeft")
5042
5042
  };
5043
5043
  goog.style.getBorderBox = function(a) {
5044
- if(goog.userAgent.IE) {
5044
+ if(goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {
5045
5045
  var b = goog.style.getIePixelBorder_(a, "borderLeft"), c = goog.style.getIePixelBorder_(a, "borderRight"), d = goog.style.getIePixelBorder_(a, "borderTop");
5046
5046
  a = goog.style.getIePixelBorder_(a, "borderBottom");
5047
5047
  return new goog.math.Box(d, c, a, b)
@@ -5292,6 +5292,7 @@ bot.userAgent.IE_DOC_PRE10 = goog.userAgent.IE && !goog.userAgent.isDocumentMode
5292
5292
  bot.userAgent.ANDROID_PRE_GINGERBREAD = goog.userAgent.product.ANDROID && !bot.userAgent.isProductVersion(2.3);
5293
5293
  bot.userAgent.ANDROID_PRE_ICECREAMSANDWICH = goog.userAgent.product.ANDROID && !bot.userAgent.isProductVersion(4);
5294
5294
  bot.userAgent.SAFARI_6 = goog.userAgent.product.SAFARI && bot.userAgent.isProductVersion(6);
5295
+ bot.userAgent.WINDOWS_PHONE = goog.userAgent.IE && -1 != goog.userAgent.getUserAgentString().indexOf("IEMobile");
5295
5296
  goog.json = {};
5296
5297
  goog.json.isValid_ = function(a) {
5297
5298
  return/^\s*$/.test(a) ? !1 : /^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g, "@").replace(/"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g, ""))
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: selenium-webdriver
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.35.1
5
+ version: 2.37.0
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: 2013-08-26 00:00:00 +02:00
13
+ date: 2013-10-18 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirement: &id002 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
- - - <
33
+ - - ~>
34
34
  - !ruby/object:Gem::Version
35
35
  version: 1.0.0
36
36
  type: :runtime
@@ -230,8 +230,8 @@ files:
230
230
  - COPYING
231
231
  has_rdoc: true
232
232
  homepage: http://selenium.googlecode.com
233
- licenses: []
234
-
233
+ licenses:
234
+ - Apache
235
235
  post_install_message:
236
236
  rdoc_options: []
237
237