Skip to content

Commit

Permalink
make it work for capybara
Browse files Browse the repository at this point in the history
  • Loading branch information
AdnoC committed Jul 19, 2023
1 parent 4b670c9 commit 95179a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/axe-core-api/lib/axe/api/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions packages/axe-core-api/lib/axe/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 95179a9

Please sign in to comment.