axe-core-api 4.8.2 → 4.9.0.pre.a02013a

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: 9b8806c168cddf5c13cddbfa83b3f3169ccf4b87f0bf8e73ea429eb9bca78767
4
- data.tar.gz: b538f8dc8b5e675a89d624f0cf05b0c0470282595912d80314fb380662f940c9
3
+ metadata.gz: 7f01485e81139a1e5e59c80cd34ae05688c7632f4f2ba2fd38eb2b6d2d1fdc27
4
+ data.tar.gz: 4d71257d8022bf6d6d1659fcbf86f17781bbe64ef8efc2cd758ec689be38910a
5
5
  SHA512:
6
- metadata.gz: f7f545316e6f08d8939e281ecb859d5436d919428f9822a63f3e010eff0c7c3a531d55acd287b5b0a897d8bacf6e3b35d75a76f1aee0c5037cdf4d6fb9e8cdd0
7
- data.tar.gz: 96ddf6abda7f1ffdc8ae44d07ee781815288b49f9f02ae8fd9d0bacde65a8e1d07a98b24c61dbb7c083fcca19dbe1eaa3201e909b36f6ba49ba1835ba86b6afa
6
+ metadata.gz: 3f66e450956027b08dd4a1f05eada1326f924ca839ddcf16f3a71357d5d3fd66a460e6ffaac0a98ceeb25f3cd89dd6975af138ce8e6dc01a506abf994583fa26
7
+ data.tar.gz: 19a57bfb3c8f8e14be662d3d8c068e51f48ff86d67eb10ba1b7f61d2164fae07be13f9d677d3a54245c7f8b0388338498e34a1ce8d7fd03a0c5232cf15578ca1
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