axe-core-api 4.8.2.pre.182d9c9 → 4.9.0.pre.0d32cea

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a2e67441c419b7a784c90ee0df6f377ef92315361ef3dd1573ec7ea0bdab289
4
- data.tar.gz: d4346145c5ec1ba707fce23ea01413e66510c7d6175f803cd6616a648bacb72e
3
+ metadata.gz: dcd6f22c1869a0d88a49f92ed2b15fa1fc9aa0c5102742dc6d402a398988e175
4
+ data.tar.gz: e415e66646125562d5475a4a7688ef81a6bdc7847b4659bb060f444897172221
5
5
  SHA512:
6
- metadata.gz: f0022558c3e79f9f5bbbc4853b75c643e657227bf6f8b7328e796f04fa926333c6263c5de12d19f33bd02495709aa09be3ff58e5e0cb495a658dda356c080cd8
7
- data.tar.gz: cb40a5a7539e75e3640dbf4963b5acedd608c7fdd14fdcd735705c911abdb6c9a35728fdbcf5fdc046e846b53fd2e6c56b6a740eb9c6fd1682ac15c8ee48dd56
6
+ metadata.gz: 1da1346644cd6e59495a8666441ea42eae0bb317589a3751621db663d48753469d9413a9930bb5a56b2c36bf4cec46cd2cc4b47c984a411293bafb8216cf9cd5
7
+ data.tar.gz: 307d79c1a4d47e7ff82b8f6b3590fbe6b15737b3185af79c0cebb6cc6cbc5edcf82b8ef4f89c2bca5d1138611618aa6aa0ef017bf10f5b18901c0a140b52618f
data/lib/axe/api/run.rb CHANGED
@@ -87,22 +87,28 @@ module Axe
87
87
 
88
88
  def within_about_blank_context(page)
89
89
  driver = get_selenium page
90
+ # This is a workaround to maintain Selenium 3 support
91
+ # Likely driver.switch_to.new_window(:tab) should be used instead, should we drop support, as per
92
+ # https://github.com/dequelabs/axe-core-gems/issues/352
90
93
 
91
- num_handles = page.window_handles.length
94
+ before_handles = page.window_handles
92
95
  begin
93
96
  driver.execute_script("window.open('about:blank'), '_blank'")
94
- if num_handles == page.window_handles.length
95
- raise StandardError.new "Could not open new window. Please make sure that you have popup blockers disabled."
96
- end
97
- driver.switch_to.window page.window_handles[-1]
98
97
  rescue
99
- raise StandardError.new "switchToWindow failed. Are you using updated browser drivers? Please check out https://github.com/dequelabs/axe-core-gems/blob/develop/error-handling.md"
98
+ raise StandardError.new "switchToWindow failed. Are you using updated browser drivers? Please check out https://github.com/dequelabs/axe-core-gems/blob/develop/error-handling.md"
99
+ end
100
+ after_handles = page.window_handles
101
+ new_handles = after_handles.difference(before_handles)
102
+ if new_handles.length != 1
103
+ raise StandardError.new "Unable to determine window handle"
100
104
  end
105
+ new_handle = new_handles[0]
106
+ driver.switch_to.window new_handle
101
107
  driver.get "about:blank"
102
108
 
103
109
  ret = yield page
104
110
 
105
- driver.switch_to.window page.window_handles[-1]
111
+ driver.switch_to.window new_handle
106
112
  driver.close
107
113
  driver.switch_to.window @original_window
108
114
 
data/lib/axe/core.rb CHANGED
@@ -38,22 +38,8 @@ module Axe
38
38
  Core.has_run_partial?(@page) and not Axe::Configuration.instance.legacy_mode
39
39
  end
40
40
 
41
- def assert_frame_ready
42
- begin
43
- ready = Timeout.timeout(10) {
44
- @page.evaluate_script <<-JS
45
- document.readyState === 'complete'
46
- JS
47
- }
48
- rescue Timeout::Error
49
- ready = false
50
- end
51
- raise Exception.new "Page/frame not ready" if not ready
52
- end
53
-
54
41
  def load_axe_core(source)
55
42
  return if already_loaded?
56
- assert_frame_ready
57
43
  loader = Common::Loader.new(@page, self)
58
44
  loader.load_top_level source
59
45
  return if use_run_partial