selenium-webdriver 3.0.5 → 3.0.7

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,19 @@
1
+ 3.0.7 (2016-02-06)
2
+ ===================
3
+
4
+ Firefox:
5
+ * Fix signature of element arrays returned from #find_elements (issue 3471)
6
+
7
+ 3.0.6 (2016-02-05)
8
+ ===================
9
+
10
+ Firefox:
11
+ * Implement W3C window position
12
+ * Update implementation for W3C send text to alert
13
+ * Implement timeout settings
14
+ * Remove default capabilities (thanks lmtierney)
15
+ * Fix signature of elements returned from #execute_script (thanks Thomas Walpole)
16
+
1
17
  3.0.5 (2016-12-27)
2
18
  ===================
3
19
 
data/README.md CHANGED
@@ -16,7 +16,7 @@ and has been tested to work on MRI (2.0 through 2.2),
16
16
 
17
17
  ## License
18
18
 
19
- Copyright 2009-2016 Software Freedom Conservancy
19
+ Copyright 2009-2017 Software Freedom Conservancy
20
20
 
21
21
  Licensed to the Software Freedom Conservancy (SFC) under one
22
22
  or more contributor license agreements. See the NOTICE file
@@ -232,7 +232,9 @@ module Selenium
232
232
 
233
233
  def process
234
234
  @process ||= (
235
- cp = ChildProcess.build('java', '-jar', @jar, '-port', @port.to_s, *@additional_args)
235
+ # extract any additional_args that start with -D as options
236
+ properties = @additional_args.dup - @additional_args.delete_if { |arg| arg[/^-D/] }
237
+ cp = ChildProcess.build('java', *properties, '-jar', @jar, '-port', @port.to_s, *@additional_args)
236
238
  io = cp.io
237
239
 
238
240
  if @log.is_a?(String)
@@ -40,6 +40,7 @@ module Selenium
40
40
  @process = ChildProcess.build(*server_command)
41
41
 
42
42
  @process.io.inherit! if $DEBUG
43
+ @process.leader = true
43
44
  @process.start
44
45
  end
45
46
 
@@ -32,7 +32,6 @@ module Selenium
32
32
  arg.map { |e| unwrap_script_result(e) }
33
33
  when Hash
34
34
  element_id = element_id_from(arg)
35
- element_id = arg if self.is_a?(Remote::W3CBridge) && element_id
36
35
  return Element.new(self, element_id) if element_id
37
36
  arg.each { |k, v| arg[k] = unwrap_script_result(v) }
38
37
  else
@@ -306,7 +306,8 @@ module Selenium
306
306
  #
307
307
 
308
308
  def as_json(*)
309
- @id.is_a?(Hash) ? @id : {:ELEMENT => @id}
309
+ key = bridge.is_a?(Remote::W3CBridge) ? 'element-6066-11e4-a52e-4f735466cecf' : 'ELEMENT'
310
+ @id.is_a?(Hash) ? @id : {key => @id}
310
311
  end
311
312
 
312
313
  private
@@ -77,52 +77,6 @@ module Selenium
77
77
  @service.stop if @service
78
78
  end
79
79
 
80
- def execute_script(script, *args)
81
- result = execute :execute_script, {}, {script: script, args: args}
82
- unwrap_script_result result
83
- end
84
-
85
- def execute_async_script(script, *args)
86
- result = execute :execute_async_script, {}, {script: script, args: args}
87
- unwrap_script_result result
88
- end
89
-
90
- def submit_element(element)
91
- execute :submit_element, id: element['ELEMENT']
92
- end
93
-
94
- def double_click
95
- execute :double_click
96
- end
97
-
98
- def click
99
- execute :click, {}, {button: 0}
100
- end
101
-
102
- def context_click
103
- execute :click, {}, {button: 2}
104
- end
105
-
106
- def mouse_down
107
- execute :mouse_down
108
- end
109
-
110
- def mouse_up
111
- execute :mouse_up
112
- end
113
-
114
- def mouse_move_to(element, x = nil, y = nil)
115
- element_id = element['ELEMENT'] if element
116
- params = {element: element_id}
117
-
118
- if x && y
119
- params[:xoffset] = x
120
- params[:yoffset] = y
121
- end
122
-
123
- execute :mouse_move_to, {}, params
124
- end
125
-
126
80
  def send_keys_to_active_element(key)
127
81
  execute :send_keys_to_active_element, {}, {value: key}
128
82
  end
@@ -56,7 +56,8 @@ module Selenium
56
56
  private
57
57
 
58
58
  def create_capabilities(opts)
59
- caps = opts.delete(:desired_capabilities) || Remote::W3CCapabilities.firefox
59
+ caps = Remote::W3CCapabilities.firefox
60
+ caps.merge!(opts.delete(:desired_capabilities)) if opts.key? :desired_capabilities
60
61
  firefox_options_caps = caps[:firefox_options] || {}
61
62
  caps[:firefox_options] = firefox_options_caps.merge(opts[:firefox_options] || {})
62
63
  if opts.key?(:profile)
@@ -108,9 +108,6 @@ module Selenium
108
108
  end
109
109
 
110
110
  def create_session(desired_capabilities)
111
- # TODO - Remove this when Mozilla fixes bug
112
- desired_capabilities[:browser_name] = 'firefox' if desired_capabilities[:browser_name] == 'Firefox'
113
-
114
111
  resp = raw_execute :new_session, {}, {desiredCapabilities: desired_capabilities}
115
112
  @session_id = resp['sessionId']
116
113
  return W3CCapabilities.json_create resp['value'] if @session_id
@@ -151,7 +148,7 @@ module Selenium
151
148
  end
152
149
 
153
150
  def alert=(keys)
154
- execute :send_alert_text, {}, {handler: 'prompt', text: keys}
151
+ execute :send_alert_text, {}, {value: keys.split(//)}
155
152
  end
156
153
 
157
154
  def alert_text
@@ -257,12 +254,13 @@ module Selenium
257
254
  Dimension.new data['width'], data['height']
258
255
  end
259
256
 
260
- def reposition_window(_x, _y, _handle = nil)
261
- raise Error::UnsupportedOperationError, 'The W3C standard does not currently support setting the Window Position'
257
+ def reposition_window(x, y)
258
+ execute :set_window_position, {}, {x: x, y: y}
262
259
  end
263
260
 
264
- def window_position(_handle = nil)
265
- raise Error::UnsupportedOperationError, 'The W3C standard does not currently support getting the Window Position'
261
+ def window_position
262
+ data = execute :get_window_position
263
+ Point.new data['x'], data['y']
266
264
  end
267
265
 
268
266
  def screenshot
@@ -384,7 +382,7 @@ module Selenium
384
382
  #
385
383
 
386
384
  def click_element(element)
387
- execute :element_click, id: element.values.first
385
+ execute :element_click, id: element
388
386
  end
389
387
 
390
388
  def click
@@ -424,11 +422,11 @@ module Selenium
424
422
 
425
423
  # TODO: - Implement file verification
426
424
  def send_keys_to_element(element, keys)
427
- execute :element_send_keys, {id: element.values.first}, {value: keys.join('').split(//)}
425
+ execute :element_send_keys, {id: element}, {value: keys.join('').split(//)}
428
426
  end
429
427
 
430
428
  def clear_element(element)
431
- execute :element_clear, id: element.values.first
429
+ execute :element_clear, id: element
432
430
  end
433
431
 
434
432
  def submit_element(element)
@@ -439,7 +437,7 @@ module Selenium
439
437
  end
440
438
 
441
439
  def drag_element(element, right_by, down_by)
442
- execute :drag_element, {id: element.values.first}, {x: right_by, y: down_by}
440
+ execute :drag_element, {id: element}, {x: right_by, y: down_by}
443
441
  end
444
442
 
445
443
  def touch_single_tap(element)
@@ -500,7 +498,7 @@ module Selenium
500
498
  #
501
499
 
502
500
  def element_tag_name(element)
503
- execute :get_element_tag_name, id: element.values.first
501
+ execute :get_element_tag_name, id: element
504
502
  end
505
503
 
506
504
  def element_attribute(element, name)
@@ -508,7 +506,7 @@ module Selenium
508
506
  end
509
507
 
510
508
  def element_property(element, name)
511
- execute :get_element_property, id: element.ref.values.first, name: name
509
+ execute :get_element_property, id: element.ref, name: name
512
510
  end
513
511
 
514
512
  def element_value(element)
@@ -516,11 +514,11 @@ module Selenium
516
514
  end
517
515
 
518
516
  def element_text(element)
519
- execute :get_element_text, id: element.values.first
517
+ execute :get_element_text, id: element
520
518
  end
521
519
 
522
520
  def element_location(element)
523
- data = execute :get_element_rect, id: element.values.first
521
+ data = execute :get_element_rect, id: element
524
522
 
525
523
  Point.new data['x'], data['y']
526
524
  end
@@ -531,25 +529,25 @@ module Selenium
531
529
  end
532
530
 
533
531
  def element_size(element)
534
- data = execute :get_element_rect, id: element.values.first
532
+ data = execute :get_element_rect, id: element
535
533
 
536
534
  Dimension.new data['width'], data['height']
537
535
  end
538
536
 
539
537
  def element_enabled?(element)
540
- execute :is_element_enabled, id: element.values.first
538
+ execute :is_element_enabled, id: element
541
539
  end
542
540
 
543
541
  def element_selected?(element)
544
- execute :is_element_selected, id: element.values.first
542
+ execute :is_element_selected, id: element
545
543
  end
546
544
 
547
545
  def element_displayed?(element)
548
- execute :is_element_displayed, id: element.values.first
546
+ execute :is_element_displayed, id: element
549
547
  end
550
548
 
551
549
  def element_value_of_css_property(element, prop)
552
- execute :get_element_css_value, id: element.values.first, property_name: prop
550
+ execute :get_element_css_value, id: element, property_name: prop
553
551
  end
554
552
 
555
553
  #
@@ -566,23 +564,23 @@ module Selenium
566
564
  how, what = convert_locators(how, what)
567
565
 
568
566
  id = if parent
569
- execute :find_child_element, {id: parent.values.first}, {using: how, value: what}
567
+ execute :find_child_element, {id: parent}, {using: how, value: what}
570
568
  else
571
569
  execute :find_element, {}, {using: how, value: what}
572
570
  end
573
- Element.new self, id
571
+ Element.new self, element_id_from(id)
574
572
  end
575
573
 
576
574
  def find_elements_by(how, what, parent = nil)
577
575
  how, what = convert_locators(how, what)
578
576
 
579
577
  ids = if parent
580
- execute :find_child_elements, {id: parent.values.first}, {using: how, value: what}
578
+ execute :find_child_elements, {id: parent}, {using: how, value: what}
581
579
  else
582
580
  execute :find_elements, {}, {using: how, value: what}
583
581
  end
584
582
 
585
- ids.map { |id| Element.new self, id }
583
+ ids.map { |id| Element.new self, element_id_from(id) }
586
584
  end
587
585
 
588
586
  private
@@ -24,27 +24,28 @@ module Selenium
24
24
  # Specification of the desired and/or actual capabilities of the browser that the
25
25
  # server is being asked to create.
26
26
  #
27
- class W3CCapabilities
28
- DEFAULTS = {
29
- browser_name: '',
30
- browser_version: :any,
31
- platform_name: :any,
32
- platform_version: :any,
33
- accept_ssl_certs: false,
34
- page_load_strategy: 'normal',
35
- proxy: nil
36
- }.freeze
37
27
 
28
+ # TODO - uncomment when Mozilla fixes this:
29
+ # https://bugzilla.mozilla.org/show_bug.cgi?id=1326397
30
+ class W3CCapabilities
38
31
  KNOWN = [
32
+ :browser_name,
33
+ :browser_version,
34
+ :platform_name,
35
+ :platform_version,
36
+ :accept_insecure_certs,
37
+ :page_load_strategy,
38
+ :proxy,
39
39
  :remote_session_id,
40
- :xul_app_id,
41
- :raise_accessibility_exceptions,
40
+ :accessibility_checks,
42
41
  :rotatable,
43
- :app_build_id,
44
- :device
42
+ :device,
43
+ :implicit_timeout,
44
+ :page_load_timeout,
45
+ :script_timeout,
45
46
  ].freeze
46
47
 
47
- (DEFAULTS.keys + KNOWN).each do |key|
48
+ KNOWN.each do |key|
48
49
  define_method key do
49
50
  @capabilities.fetch(key)
50
51
  end
@@ -78,7 +79,10 @@ module Selenium
78
79
  def firefox(opts = {})
79
80
  opts[:browser_version] = opts.delete(:version) if opts.key?(:version)
80
81
  opts[:platform_name] = opts.delete(:platform) if opts.key?(:platform)
81
-
82
+ opts[:timeouts] = {}
83
+ opts[:timeouts]['implicit'] = opts.delete(:implicit_timeout) if opts.key?(:implicit_timeout)
84
+ opts[:timeouts]['page load'] = opts.delete(:page_load_timeout) if opts.key?(:page_load_timeout)
85
+ opts[:timeouts]['script'] = opts.delete(:script_timeout) if opts.key?(:script_timeout)
82
86
  new({browser_name: 'firefox', marionette: true}.merge(opts))
83
87
  end
84
88
 
@@ -96,32 +100,28 @@ module Selenium
96
100
  def json_create(data)
97
101
  data = data.dup
98
102
 
99
- # Convert due to Remote Driver implementation
100
- data['browserVersion'] = data.delete('version') if data.key? 'version'
101
- data['platformName'] = data.delete('platform') if data.key? 'platform'
102
-
103
103
  caps = new
104
104
  caps.browser_name = data.delete('browserName')
105
105
  caps.browser_version = data.delete('browserVersion')
106
106
  caps.platform_name = data.delete('platformName')
107
107
  caps.platform_version = data.delete('platformVersion')
108
- caps.accept_ssl_certs = data.delete('acceptSslCerts')
108
+ caps.accept_insecure_certs = data.delete('acceptInsecureCerts') if data.key?('acceptInsecureCerts')
109
109
  caps.page_load_strategy = data.delete('pageLoadStrategy')
110
+ timeouts = data.delete('timeouts')
111
+ caps.implicit_timeout = timeouts['implicit'] if timeouts
112
+ caps.page_load_timeout = timeouts['page load'] if timeouts
113
+ caps.script_timeout = timeouts['script'] if timeouts
114
+
110
115
  proxy = data.delete('proxy')
111
116
  caps.proxy = Proxy.json_create(proxy) unless proxy.nil? || proxy.empty?
112
117
 
113
118
  # Remote Server Specific
114
119
  caps[:remote_session_id] = data.delete('webdriver.remote.sessionid')
115
120
 
116
- # Obsolete capabilities returned by Remote Server
117
- data.delete('javascriptEnabled')
118
- data.delete('cssSelectorsEnabled')
119
-
120
121
  # Marionette Specific
121
- caps[:xul_app_id] = data.delete('XULappId')
122
- caps[:raise_accessibility_exceptions] = data.delete('raisesAccessibilityExceptions')
122
+ caps[:accessibility_checks] = data.delete('moz:accessibilityChecks')
123
+ caps[:profile] = data.delete('moz:profile')
123
124
  caps[:rotatable] = data.delete('rotatable')
124
- caps[:app_build_id] = data.delete('appBuildId')
125
125
  caps[:device] = data.delete('device')
126
126
 
127
127
  # any remaining pairs will be added as is, with no conversion
@@ -135,14 +135,14 @@ module Selenium
135
135
  # @option :browser_version [String] required browser version number
136
136
  # @option :platform_name [Symbol] one of :any, :win, :mac, or :x
137
137
  # @option :platform_version [String] required platform version number
138
- # @option :accept_ssl_certs [Boolean] does the driver accept SSL Cerfifications?
138
+ # @option :accept_insecure_certs [Boolean] does the driver accept SSL Cerfifications?
139
139
  # @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
140
140
  #
141
141
  # @api public
142
142
  #
143
143
 
144
144
  def initialize(opts = {})
145
- @capabilities = DEFAULTS.merge(opts)
145
+ @capabilities = opts
146
146
  self.proxy = opts.delete(:proxy)
147
147
  end
148
148
 
@@ -57,6 +57,8 @@ module Selenium
57
57
  maximize_window: [:post, 'session/:session_id/window/maximize'.freeze],
58
58
  set_window_size: [:post, 'session/:session_id/window/size'.freeze],
59
59
  get_window_size: [:get, 'session/:session_id/window/size'.freeze],
60
+ set_window_position: [:post, 'session/:session_id/window/position'.freeze],
61
+ get_window_position: [:get, 'session/:session_id/window/position'.freeze],
60
62
  switch_to_frame: [:post, 'session/:session_id/frame'.freeze],
61
63
  switch_to_parent_frame: [:post, 'session/:session_id/frame/parent'.freeze],
62
64
 
@@ -5,7 +5,7 @@ raise "cwd must be #{root} when reading gemspec" if root != Dir.pwd
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'selenium-webdriver'
8
- s.version = '3.0.5'
8
+ s.version = '3.0.7'
9
9
 
10
10
  s.authors = ['Alex Rodionov', 'Titus Fortner']
11
11
  s.email = ['p0deje@gmail.com', 'titusfortner@gmail.com']
@@ -26,7 +26,7 @@ HTML of the application.'
26
26
  s.add_runtime_dependency 'childprocess', ['~> 0.5']
27
27
  s.add_runtime_dependency 'websocket', ['~> 1.0']
28
28
 
29
- s.add_development_dependency 'rspec', ['~> 3.0']
29
+ s.add_development_dependency 'rspec', ['< 3.5']
30
30
  s.add_development_dependency 'rack', ['~> 1.0']
31
31
  s.add_development_dependency 'ci_reporter', ['~> 1.6', '>= 1.6.2']
32
32
  s.add_development_dependency 'webmock', ['~> 2.0']
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: selenium-webdriver
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.0.5
5
+ version: 3.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alex Rodionov
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2016-12-27 00:00:00 -06:00
14
+ date: 2017-02-06 00:00:00 -06:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -53,9 +53,9 @@ dependencies:
53
53
  requirement: &id004 !ruby/object:Gem::Requirement
54
54
  none: false
55
55
  requirements:
56
- - - ~>
56
+ - - <
57
57
  - !ruby/object:Gem::Version
58
- version: "3.0"
58
+ version: "3.5"
59
59
  type: :development
60
60
  version_requirements: *id004
61
61
  - !ruby/object:Gem::Dependency