Ruby throwing Page/Frame not ready exception Safari
Zidious opened this issue · 1 comments
Zidious commented
On fast webpages such as google.com I am encountering an intermittent issue when running axe. On slower pages such as https://dequeuniversity.com/demo/mars/ I am not encountering this error.
Example:
require "selenium-webdriver"
require "axe/api/run"
require "json"
driver = Selenium::WebDriver.for :safari
driver.navigate.to "https://google.com"
res = Axe::Core.new(driver).call Axe::API::Run.new.with_options
puts JSON.pretty_generate res.results.to_h
driver.quit
Throws:
➜ ruby ruby_qustion.rb
/usr/local/lib/ruby/gems/3.1.0/gems/axe-core-api-4.8.0/lib/axe/core.rb:51:in `assert_frame_ready': Page/frame not ready (Exception)
from /usr/local/lib/ruby/gems/3.1.0/gems/axe-core-api-4.8.0/lib/axe/core.rb:56:in `load_axe_core'
from /usr/local/lib/ruby/gems/3.1.0/gems/axe-core-api-4.8.0/lib/axe/core.rb:14:in `initialize'
from ruby_qustion.rb:9:in `new'
from ruby_qustion.rb:9:in `<main>'
NoSuchWindowException
- #352
padmavemulapati commented
Verified with the latest QA-build ( axe-core-gems_4.9.1.pre.396d719) on both Cucumebr and Rspec (which we are supporting now) using seleniium-driver. Not reproducing the issue, its working on safari browsser with out throwing nay error or exceptions.
Cucumber-selenium:
Driver setup:
# load selenium
require "selenium-webdriver"
# require driver of choice
require "axe-selenium"
# Requiring 'axe-cucumber-steps' makes all of the axe-cucumber step
# definitions available to be used directly in your cucumber features.
require "axe-cucumber-steps"
Before do
# configure AxeSelenium
@driver = AxeSelenium.configure(:safari) do |c|
end
end
# close browser when done
After do
@driver.page.close
end
Page executing:
Feature: Axe-core-Ruby-Cucumber-Selenium Tests
Background:
Given I am a visitor
Scenario: Test whole page
When I visit "http://qateam.dequecloud.com/attest/api/test.html"
Then I verify the page has "8" accessibility issues
Its working as expected.
attached recording
video1403687178.mp4
Rspec-selenium:
Driver setup:
require "rspec"
require "axe-rspec"
require "axe-selenium"
RSpec.configure do |config|
config.before :each do
@driver = AxeSelenium.configure(:safari) do |c|
end
end
config.color = true
end
Page executing:
require "spec_helper"
require 'axe/core'
require 'axe/api/run'
# Typical example using standard RSpec dsl
describe "TestPage (RSpec DSL)",
:type => :feature, :driver => :selenium do
it "Test whole page" do
@driver.page.navigate.to "http://qateam.dequecloud.com/attest/api/test.html"
axe_results = Axe::Core.new(@driver.page).call Axe::API::Run.new
puts(axe_results.results.testEngine["version"])
begin
expect(@driver.page).to be_axe_clean
rescue RSpec::Expectations::ExpectationNotMetError => e
expect("#{e.message}").to include("Found 8 accessibility violation"), "Accessibility issues count mismatch"
end
end
Its working as expected.
attached recording
video3403687178.mp4
Environment:
Label | Value |
---|---|
Product | axe-core-gems |
Version | 4.9.1.pre.396d719 |
Pacakges | Cucumber and RSpec |
Driver | Selenium |
OS-Details | _MAC- Intel Core i7 - 11.6.8 _ |
BrowserDetails | Safari Version 17.4.1 (19618.1.15.11.14) |