capybara-playwright-driver icon indicating copy to clipboard operation
capybara-playwright-driver copied to clipboard

page.go_back doesn't work under webkit

Open searls opened this issue 1 month ago • 2 comments

Try as I might, I believe page.go_back will always timeout under webkit

searls avatar Oct 31 '25 16:10 searls

Thank you for reporting this issue.

I've created a test spec to verify the page.go_back functionality with WebKit, and it appears to be working correctly in my environment.

Here's the example code I used:

require 'spec_helper'

RSpec.describe 'navigation', sinatra: true do
  before do
    sinatra.get '/page1' do
      <<~HTML
      <!DOCTYPE html>
      <html>
      <head><title>Page 1</title></head>
      <body>
        <h1>Page 1</h1>
        <a href="/page2">Go to Page 2</a>
      </body>
      </html>
      HTML
    end

    sinatra.get '/page2' do
      <<~HTML
      <!DOCTYPE html>
      <html>
      <head><title>Page 2</title></head>
      <body>
        <h1>Page 2</h1>
        <a href="/page3">Go to Page 3</a>
      </body>
      </html>
      HTML
    end

    sinatra.get '/page3' do
      <<~HTML
      <!DOCTYPE html>
      <html>
      <head><title>Page 3</title></head>
      <body>
        <h1>Page 3</h1>
      </body>
      </html>
      HTML
    end
  end

  describe 'page.go_back' do
    it 'navigates back to the previous page' do
      visit '/page1'
      expect(page).to have_content('Page 1')

      click_link 'Go to Page 2'
      expect(page).to have_content('Page 2')

      page.go_back
      expect(page).to have_content('Page 1')
    end

    it 'can navigate back multiple times' do
      visit '/page1'
      expect(page).to have_content('Page 1')

      click_link 'Go to Page 2'
      expect(page).to have_content('Page 2')

      click_link 'Go to Page 3'
      expect(page).to have_content('Page 3')

      page.go_back
      expect(page).to have_content('Page 2')

      page.go_back
      expect(page).to have_content('Page 1')
    end
  end
end

Running this test with WebKit:

BROWSER=webkit bundle exec rspec spec/feature/navigation_spec.rb

Result: 3 examples, 0 failures (completed in 6.95 seconds)

All tests passed successfully, indicating that page.go_back is working correctly with WebKit in this scenario.

Could you please provide more details about the specific conditions under which you're experiencing the timeout? It would be helpful if you could share:

  1. Steps to reproduce the issue
  2. Sample code that demonstrates the problem
  3. Error message or timeout details you're encountering
  4. Your environment setup (OS, Ruby version, gem versions, etc.)
  5. Any specific page characteristics that might be relevant (e.g., JavaScript-heavy pages, SPAs, specific navigation patterns)

This information will help us identify the root cause and reproduce the issue on our end. Thank you!

YusukeIwaki avatar Nov 04 '25 12:11 YusukeIwaki

I apologize for apparently wasting your time @YusukeIwaki! i still can't get it to work but I also am struggling to extract a reproducible example you'll be able to easily test with in isolation. Feel free to close this until I do

searls avatar Nov 04 '25 12:11 searls