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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/axe/api/run.rb +7 -13
  3. data/lib/axe/core.rb +14 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f01485e81139a1e5e59c80cd34ae05688c7632f4f2ba2fd38eb2b6d2d1fdc27
4
- data.tar.gz: 4d71257d8022bf6d6d1659fcbf86f17781bbe64ef8efc2cd758ec689be38910a
3
+ metadata.gz: a8a023c7a7f45ee16e8ac93999a77a11d30fdbaba947089650c7e40361b5b5d8
4
+ data.tar.gz: 37c27c50c9f40450e042c4ec693ff11a10d37546cf9570c75ed3f41caa0245e4
5
5
  SHA512:
6
- metadata.gz: 3f66e450956027b08dd4a1f05eada1326f924ca839ddcf16f3a71357d5d3fd66a460e6ffaac0a98ceeb25f3cd89dd6975af138ce8e6dc01a506abf994583fa26
7
- data.tar.gz: 19a57bfb3c8f8e14be662d3d8c068e51f48ff86d67eb10ba1b7f61d2164fae07be13f9d677d3a54245c7f8b0388338498e34a1ce8d7fd03a0c5232cf15578ca1
6
+ metadata.gz: 5a0475c5d177f108dc8e303f759febe2dfec66ee6bf6346893b085177e0cf039d502584ee0320009ae71c7b6578d3f6a63f959e7048ee3cb883ac6875d019b76
7
+ data.tar.gz: 4f78272ff241f4c3f1cdda7a9a7176b1660a5f1b3b7cf951ff17042f87cc3f12372041f96228d5ad7f32916cf90283e4f987d39104da65d61fbb8a30a87e3285
data/lib/axe/api/run.rb CHANGED
@@ -87,28 +87,22 @@ 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
93
90
 
94
- before_handles = page.window_handles
91
+ num_handles = page.window_handles.length
95
92
  begin
96
93
  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]
97
98
  rescue
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"
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"
104
100
  end
105
- new_handle = new_handles[0]
106
- driver.switch_to.window new_handle
107
101
  driver.get "about:blank"
108
102
 
109
103
  ret = yield page
110
104
 
111
- driver.switch_to.window new_handle
105
+ driver.switch_to.window page.window_handles[-1]
112
106
  driver.close
113
107
  driver.switch_to.window @original_window
114
108
 
data/lib/axe/core.rb CHANGED
@@ -38,8 +38,22 @@ 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
+
41
54
  def load_axe_core(source)
42
55
  return if already_loaded?
56
+ assert_frame_ready
43
57
  loader = Common::Loader.new(@page, self)
44
58
  loader.load_top_level source
45
59
  return if use_run_partial
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: axe-core-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.0.pre.a02013a
4
+ version: 4.9.0.pre.bd26a87
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deque Systems
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-23 00:00:00.000000000 Z
11
+ date: 2024-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dumb_delegator