selenium-webdriver 3.5.2 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,19 @@
1
+ 3.6.0 (2017-09-22)
2
+ ==================
3
+
4
+ Edge:
5
+ * Fixed a bug when execute_script failed using server + Edge (issue #4651)
6
+
7
+ Firefox:
8
+ * Fixed a bug when web extension failed to install using profile class (issue #4093)
9
+
10
+ PhantomJS:
11
+ * Support is deprecated in favor of headless Chrome/Firefox or HTMLUnit.
12
+ PhantomJS is no longer actively developed, and support will eventually
13
+ be dropped.
14
+
1
15
  3.5.2 (2017-09-07)
2
- ==================
16
+ ==================
3
17
 
4
18
  Ruby:
5
19
  * Removed platformVersion from W3C payload (issue #4641)
@@ -84,7 +84,7 @@ module Selenium
84
84
  progress += segment.length
85
85
  segment_count += 1
86
86
 
87
- if segment_count % 15 == 0
87
+ if (segment_count % 15).zero?
88
88
  percent = (progress.to_f / total.to_f) * 100
89
89
  print "#{CL_RESET}Downloading #{download_file_name}: #{percent.to_i}% (#{progress} / #{total})"
90
90
  segment_count = 0
File without changes
@@ -117,7 +117,7 @@ module Selenium
117
117
  end
118
118
 
119
119
  def make_writable(file)
120
- File.chmod 0766, file
120
+ File.chmod 0o766, file
121
121
  end
122
122
 
123
123
  def assert_file(path)
@@ -208,7 +208,7 @@ module Selenium
208
208
  end # WebDriver
209
209
  end # Selenium
210
210
 
211
- if __FILE__ == $PROGRAM_NAME
211
+ if $PROGRAM_NAME == __FILE__
212
212
  p engine: Selenium::WebDriver::Platform.engine,
213
213
  os: Selenium::WebDriver::Platform.os,
214
214
  ruby_version: Selenium::WebDriver::Platform.ruby_version,
@@ -40,6 +40,7 @@ module Selenium
40
40
 
41
41
  IGNORED_ERRORS = [Errno::EADDRNOTAVAIL]
42
42
  IGNORED_ERRORS << Errno::EBADF if Platform.cygwin?
43
+ IGNORED_ERRORS << Errno::EACCES if Platform.windows?
43
44
  IGNORED_ERRORS.freeze
44
45
 
45
46
  def self.free?(port)
@@ -46,7 +46,7 @@ module Selenium
46
46
 
47
47
  # TODO: must be a better way..
48
48
  FileUtils.rm_rf tmp_directory
49
- FileUtils.mkdir_p File.dirname(tmp_directory), mode: 0700
49
+ FileUtils.mkdir_p File.dirname(tmp_directory), mode: 0o700
50
50
  FileUtils.cp_r directory, tmp_directory
51
51
 
52
52
  tmp_directory
File without changes
@@ -155,7 +155,7 @@ module Selenium
155
155
  protected
156
156
 
157
157
  def extract_service_args(driver_opts)
158
- driver_opts.key?(:args) ? driver_opts.delete(:args) : []
158
+ driver_opts.key?(:args) ? driver_opts.delete(:args) : []
159
159
  end
160
160
 
161
161
  end # Service
@@ -24,10 +24,10 @@ module Selenium
24
24
 
25
25
  def commands(command)
26
26
  unsupported = %i[execute_script execute_async_script submit_element double_click
27
- mouse_down mouse_up mouse_move_to click
28
- send_keys_to_active_element get_window_handles get_current_window_handle
29
- get_window_size set_window_size get_window_position set_window_position
30
- maximize_window get_alert_text accept_alert dismiss_alert]
27
+ mouse_down mouse_up mouse_move_to click
28
+ send_keys_to_active_element get_window_handles get_current_window_handle
29
+ get_window_size set_window_size get_window_position set_window_position
30
+ maximize_window get_alert_text accept_alert dismiss_alert]
31
31
  if unsupported.include? command
32
32
  Remote::OSS::Bridge::COMMANDS[command]
33
33
  else
@@ -38,10 +38,10 @@ module Selenium
38
38
 
39
39
  def write_to(extensions_dir)
40
40
  root_dir = create_root
41
- ext_path = File.join extensions_dir, read_id_from_install_rdf(root_dir)
41
+ ext_path = File.join extensions_dir, read_id(root_dir)
42
42
 
43
43
  FileUtils.rm_rf ext_path
44
- FileUtils.mkdir_p File.dirname(ext_path), mode: 0700
44
+ FileUtils.mkdir_p File.dirname(ext_path), mode: 0o700
45
45
  FileUtils.cp_r root_dir, ext_path
46
46
 
47
47
  FileReaper.reap(root_dir) if @should_reap_root
@@ -62,8 +62,14 @@ module Selenium
62
62
  end
63
63
  end
64
64
 
65
+ def read_id(directory)
66
+ read_id_from_install_rdf(directory) || read_id_from_manifest_json(directory)
67
+ end
68
+
65
69
  def read_id_from_install_rdf(directory)
66
70
  rdf_path = File.join(directory, 'install.rdf')
71
+ return unless File.exist?(rdf_path)
72
+
67
73
  doc = REXML::Document.new(File.read(rdf_path))
68
74
  namespace = doc.root.namespaces.key(NAMESPACE)
69
75
 
@@ -77,6 +83,14 @@ module Selenium
77
83
 
78
84
  raise Error::WebDriverError, "cannot locate extension id in #{rdf_path}"
79
85
  end
86
+
87
+ def read_id_from_manifest_json(directory)
88
+ manifest_path = File.join(directory, 'manifest.json')
89
+ return unless File.exist?(manifest_path)
90
+
91
+ manifest = JSON.parse(File.read(manifest_path))
92
+ [manifest['name'].delete(' '), manifest['version']].join('@')
93
+ end
80
94
  end # Extension
81
95
  end # Firefox
82
96
  end # WebDriver
@@ -90,11 +90,11 @@ module Selenium
90
90
  end
91
91
 
92
92
  def fetch_profile
93
- if @profile_name
94
- @profile = Profile.from_name @profile_name
95
- else
96
- @profile = Profile.new
97
- end
93
+ @profile = if @profile_name
94
+ Profile.from_name @profile_name
95
+ else
96
+ Profile.new
97
+ end
98
98
  end
99
99
 
100
100
  def assert_profile
@@ -34,7 +34,7 @@ module Selenium
34
34
 
35
35
  def install_addon(path, temporary)
36
36
  payload = {path: path}
37
- payload.merge!(temporary: temporary) unless temporary.nil?
37
+ payload[:temporary] = temporary unless temporary.nil?
38
38
  execute :install_addon, {}, payload
39
39
  end
40
40
 
@@ -30,6 +30,8 @@ module Selenium
30
30
  include DriverExtensions::TakesScreenshot
31
31
 
32
32
  def initialize(opts = {})
33
+ WebDriver.logger.deprecate 'Selenium support for PhantomJS', 'headless Chrome/Firefox or HTMLUnit'
34
+
33
35
  opts[:desired_capabilities] ||= Remote::Capabilities.phantomjs
34
36
 
35
37
  unless opts.key?(:url)
@@ -48,6 +48,15 @@ module Selenium
48
48
  end
49
49
  end
50
50
 
51
+ #
52
+ # Returns javascript_enabled capability.
53
+ # It is true if not set explicitly.
54
+ #
55
+ def javascript_enabled
56
+ javascript_enabled = @capabilities.fetch(:javascript_enabled)
57
+ javascript_enabled.nil? ? true : javascript_enabled
58
+ end
59
+
51
60
  alias_method :css_selectors_enabled?, :css_selectors_enabled
52
61
  alias_method :javascript_enabled?, :javascript_enabled
53
62
  alias_method :native_events?, :native_events
@@ -111,6 +120,7 @@ module Selenium
111
120
  alias_method :ie, :internet_explorer
112
121
 
113
122
  def phantomjs(opts = {})
123
+ WebDriver.logger.deprecate 'Selenium support for PhantomJS', 'headless Chrome/Firefox or HTMLUnit'
114
124
  new({
115
125
  browser_name: 'phantomjs',
116
126
  javascript_enabled: true,
@@ -94,7 +94,6 @@ module Selenium
94
94
  retries += 1
95
95
  sleep 2
96
96
  retry
97
-
98
97
  rescue Errno::ECONNREFUSED => ex
99
98
  raise ex.class, "using proxy: #{proxy.http}" if use_proxy?
100
99
  raise
@@ -78,12 +78,12 @@ module Selenium
78
78
  l = Float(l) / 100
79
79
  a = Float(a || 1)
80
80
 
81
- if s == 0
81
+ if s.zero?
82
82
  r = l
83
83
  g = r
84
84
  b = r
85
85
  else
86
- luminocity2 = (l < 0.5) ? l * (1 + s) : l + s - l * s
86
+ luminocity2 = l < 0.5 ? l * (1 + s) : l + s - l * s
87
87
  luminocity1 = 2 * l - luminocity2
88
88
 
89
89
  r = hue_to_rgb(luminocity1, luminocity2, h + 1.0 / 3.0)
@@ -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.5.2'
8
+ s.version = '3.6.0'
9
9
 
10
10
  s.authors = ['Alex Rodionov', 'Titus Fortner']
11
11
  s.email = ['p0deje@gmail.com', 'titusfortner@gmail.com']
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: selenium-webdriver
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.5.2
5
+ version: 3.6.0
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: 2017-09-07 00:00:00 +07:00
14
+ date: 2017-09-25 00:00:00 +02:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -96,7 +96,6 @@ extra_rdoc_files: []
96
96
  files:
97
97
  - CHANGES
98
98
  - Gemfile
99
- - Gemfile.lock
100
99
  - LICENSE
101
100
  - README.md
102
101
  - selenium-webdriver.gemspec
@@ -1,56 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- selenium-webdriver (3.5.1)
5
- childprocess (~> 0.5)
6
- rubyzip (~> 1.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- addressable (2.5.1)
12
- public_suffix (~> 2.0, >= 2.0.2)
13
- childprocess (0.7.1)
14
- ffi (~> 1.0, >= 1.0.11)
15
- crack (0.4.3)
16
- safe_yaml (~> 1.0.0)
17
- diff-lcs (1.3)
18
- ffi (1.9.18)
19
- ffi (1.9.18-x64-mingw32)
20
- hashdiff (0.3.4)
21
- public_suffix (2.0.5)
22
- rack (1.6.8)
23
- rspec (3.6.0)
24
- rspec-core (~> 3.6.0)
25
- rspec-expectations (~> 3.6.0)
26
- rspec-mocks (~> 3.6.0)
27
- rspec-core (3.6.0)
28
- rspec-support (~> 3.6.0)
29
- rspec-expectations (3.6.0)
30
- diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.6.0)
32
- rspec-mocks (3.6.0)
33
- diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.6.0)
35
- rspec-support (3.6.0)
36
- rubyzip (1.2.1)
37
- safe_yaml (1.0.4)
38
- webmock (2.3.2)
39
- addressable (>= 2.3.6)
40
- crack (>= 0.3.2)
41
- hashdiff
42
- yard (0.9.9)
43
-
44
- PLATFORMS
45
- ruby
46
- x64-mingw32
47
-
48
- DEPENDENCIES
49
- rack (~> 1.0)
50
- rspec (~> 3.0)
51
- selenium-webdriver!
52
- webmock (~> 2.0)
53
- yard (~> 0.9.9)
54
-
55
- BUNDLED WITH
56
- 1.15.4