axe-core-api 4.9.0.pre.02e93ef → 4.9.0.pre.3c7b841

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: b00550b1b3b4d3dcae23fa3ded496580438ef24a993efdbe35f2153e4bd50267
4
- data.tar.gz: 750e8dd0df4f97577cb822fc426b4082d66b2c5c4b9d54d3fd5f90020d6beed7
3
+ metadata.gz: c364b62117d66d815d4dfb9c6af322363081f04942711d22b3b07ebe4cc24960
4
+ data.tar.gz: bf59ef58bdf6f07880458abe91572a6fa27f2826d06045a72888b71cc6f5da91
5
5
  SHA512:
6
- metadata.gz: c99ae2fa9d4cae9fcbb01370365de54f799040a0f5673689bf4cdfecf2a04bcb5ecc19a5cbbd291e1623aba9aafa58a3457a3c979e6d11eedd35d802e76feb72
7
- data.tar.gz: ef7beb69aafc8abce9933b66b5416a3777df39a763e4d943909797cd964bf8d128a752bc710f2ff3ca0845085e3cbc2b1da7b232b9bbc39043f6a83d7e9ab161
6
+ metadata.gz: 3500c842db2209987da1ce6dc2d1a91c44c05e471b19562450037cde1df8142898e44ce5fed7f30b1e8c1021481f63f330078eb77502089bc1388d390548c04a
7
+ data.tar.gz: 94aee7334b6d999bbb6d1cc5af20a9b3a77e726cb49566780fe02b42b0913250c74fa72d862b9f973f36c208b39ac853d2e3dcd9d322af5409c58733f0dc5d07
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