Skip to content

[Bug]: Firefox not preserving fragment after context.route() interception #34518

Open
@Disnaming

Description

@Disnaming

Version

1.49.1

Steps to reproduce

from playwright.async_api import async_playwright

async def main():
    playwright = await async_playwright().start()
    browser = await playwright.firefox.launch()
    context = await browser.new_context()
    page = await context.new_page()
    new_page = await context.new_page()
    await page.goto("http://example.com#no-rerouted-navigation")
    print(page.url)
    await context.route("**/*", lambda route, request: route.continue_(url=request.url))
    await page.goto("http://example.com#hashchange-avoided-navigation")
    await new_page.goto("http://example.com#new-navigation-with-reroute")
    print(page.url)
    print(new_page.url) # expecting to see hash, but its not there
    await context.close()
    await browser.close()
    await playwright.stop()

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

Expected behavior

I expect to see the hash preserved after navigation.

Actual behavior

The hash is gone.

Additional context

No response

Environment

- Operating System: [Ubuntu 22.04]
- CPU: [arm64]
- Browser: [Chromium, Firefox]
- Python Version: [3.12]
- Other info:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions