Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby throwing Page/Frame not ready exception Safari #353

Closed
Zidious opened this issue Nov 20, 2023 · 1 comment · Fixed by #385
Closed

Ruby throwing Page/Frame not ready exception Safari #353

Zidious opened this issue Nov 20, 2023 · 1 comment · Fixed by #385
Labels
QA SIGNOFF: passed This ticket has passed QA

Comments

@Zidious
Copy link
Contributor

Zidious commented Nov 20, 2023

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>'

image

NoSuchWindowException - #352

scottmries added a commit that referenced this issue Apr 23, 2024
QA Notes:

The following code occasionally caused Safari to throw a
`noSuchWindowException` around 1 in 10 times, and I expect it never to
do so now.

```
require "selenium-webdriver"
require_relative "../../lib/axe/api/run"
require "json"


driver = Selenium::WebDriver.for :safari
# driver.navigate.to "http://google.com"
driver.navigate.to "https://dequeuniversity.com/demo/mars/"

res = Axe::Core.new(driver).call Axe::API::Run.new.with_options

puts JSON.pretty_generate res.results.to_h

driver.quit
```

Note the commented `# driver.navigate to "http://google.com"`. Issue
#353 notes that attempting to navigate to `http://google.com` would also
occasionally cause an exception "Page/Frame not ready" to be thrown; it
should no longer do so.

Please uncomment this line, comment `driver.navigate.to
"https://dequeuniversity.com/demo/mars/"` and test again. This fix is
included here since they are closely related.

Closes: #352
Closes: #353
dequejenn added a commit that referenced this issue May 8, 2024
##
[4.9.1](v4.9.0...v4.9.1)
(2024-05-08)


### Bug Fixes

* Safari noSuchWindowException and Page/Frame not ready
([#385](#385))
([a02013a](a02013a)),
closes [#353](#353)
[#352](#352)
[#353](#353)
* Update axe-core to v4.9.1
([#387](#387))
([0d32cea](0d32cea))
@padmavemulapati
Copy link

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)

@padmavemulapati padmavemulapati added the QA SIGNOFF: passed This ticket has passed QA label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QA SIGNOFF: passed This ticket has passed QA
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants