From 95179a949dc977fdce7e3112e155244f64e8e611 Mon Sep 17 00:00:00 2001 From: AdnoC Date: Tue, 18 Jul 2023 20:17:18 -0400 Subject: [PATCH] make it work for capybara --- packages/axe-core-api/lib/axe/api/run.rb | 6 +++--- packages/axe-core-api/lib/axe/core.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/axe-core-api/lib/axe/api/run.rb b/packages/axe-core-api/lib/axe/api/run.rb index 467fca7c..139eae67 100644 --- a/packages/axe-core-api/lib/axe/api/run.rb +++ b/packages/axe-core-api/lib/axe/api/run.rb @@ -32,7 +32,7 @@ def call(page) end def analyze_post_43x(page, lib) - page.manage.timeouts.page_load = 1 + (get_selenium page).manage.timeouts.page_load = 1 @original_window = window_handle page partial_results = run_partial_recursive(page, @context, lib, true) throw partial_results if partial_results.respond_to?("key?") and partial_results.key?("errorMessage") @@ -111,7 +111,7 @@ def window_handle(page) def run_partial_recursive(page, context, lib, top_level = false, frame_stack = []) begin - window_handle = page.window_handle + current_window_handle = window_handle page if not top_level begin Common::Loader.new(page, lib).load_top_level Axe::Configuration.instance.jslib @@ -144,7 +144,7 @@ def run_partial_recursive(page, context, lib, top_level = false, frame_stack = [ results += res rescue Selenium::WebDriver::Error::TimeoutError page = get_selenium page - page.switch_to.window window_handle + page.switch_to.window current_window_handle frame_stack.each {|frame| page.switch_to.frame frame } results.push nil end diff --git a/packages/axe-core-api/lib/axe/core.rb b/packages/axe-core-api/lib/axe/core.rb index 1826834c..80af5276 100644 --- a/packages/axe-core-api/lib/axe/core.rb +++ b/packages/axe-core-api/lib/axe/core.rb @@ -40,12 +40,12 @@ def use_run_partial def assert_frame_ready begin - ready = Timeout.timeout(1) { + ready = Timeout.timeout(10) { @page.evaluate_script <<-JS - document.reradyState === 'complete' + document.readyState === 'complete' JS } - rescue + rescue Timeout::Error ready = false end raise Exception.new "Page/frame not ready" if not ready