Skip to content

[Bug]: Page.goto() method throw error: interrupted by another navigation #3155

Description

@catnoteafish

Version

1.61.0

Steps to reproduce

Example steps (replace with your own):

  1. Create test.html and test.py in the same directory.
  2. paste the following code:
import asyncio
from pathlib import Path

from playwright.async_api import async_playwright


async def main():
  _playwright = await async_playwright().start()
  _browser = await _playwright.firefox.launch(headless=False)
  _context = await _browser.new_context(device_scale_factor=3)
  
  page = await _context.new_page()
  _ = await page.goto((Path(__file__).parent / 'test.html').as_uri())
  
  await page.wait_for_load_state('networkidle')
  _ = await page.goto('about:blank')
  
  await page.close()
  await _browser.close()
  return
  
if __name__ == '__main__':
  asyncio.run(main())
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <p class="aaa">
    test
  </p>
</body>
<style>
  .aaa {
    background-color: blue;
  }
</style>
</html>
  1. Run this code with playwright 1.61.0 installed

Output:

(bot) PS E:\bot\plugins\render_plugin> uv run .\test.py
Traceback (most recent call last):
  File "E:\bot\plugins\render_plugin\test.py", line 23, in <module>
    asyncio.run(main())
  File "C:\Users\Administrator\AppData\Roaming\uv\python\cpython-3.12-windows-x86_64-none\Lib\asyncio\runners.py", line 195, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\AppData\Roaming\uv\python\cpython-3.12-windows-x86_64-none\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\AppData\Roaming\uv\python\cpython-3.12-windows-x86_64-none\Lib\asyncio\base_events.py", line 691, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "E:\bot\plugins\render_plugin\test.py", line 15, in main
    _ = await page.goto('about:blank')
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\bot\.venv\Lib\site-packages\playwright\async_api\_generated.py", line 9764, in goto
    await self._impl_obj.goto(
  File "E:\bot\.venv\Lib\site-packages\playwright\_impl\_page.py", line 560, in goto
    return await self._main_frame.goto(**locals_to_params(locals()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\bot\.venv\Lib\site-packages\playwright\_impl\_frame.py", line 156, in goto
    await self._channel.send(
  File "E:\bot\.venv\Lib\site-packages\playwright\_impl\_connection.py", line 69, in send
    return await self._connection.wrap_api_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\bot\.venv\Lib\site-packages\playwright\_impl\_connection.py", line 563, in wrap_api_call
    raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: Page.goto: Navigation to "about:blank" is interrupted by another navigation to "about:blank"
Call log:
  - navigating to "about:blank", waiting until "load"

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Roaming\uv\python\cpython-3.12-windows-x86_64-none\Lib\asyncio\base_subprocess.py", line 126, in __del__
  File "C:\Users\Administrator\AppData\Roaming\uv\python\cpython-3.12-windows-x86_64-none\Lib\asyncio\base_subprocess.py", line 104, in close
  File "C:\Users\Administrator\AppData\Roaming\uv\python\cpython-3.12-windows-x86_64-none\Lib\asyncio\proactor_events.py", line 109, in closeevents.py", line 799, in call_soon
  File "C:\Users\Administrator\AppData\Roaming\uv\python\cpython-3.12-windows-x86_64-none\Lib\asyncio\base_events.py", line 545, in _check_closed
RuntimeError: Event loop is closed
(bot) PS E:\bot\plugins\render_plugin> uv pip list | grep.exe 'playwright'
Using Python 3.12.13 environment at: E:\bot\.venv
playwright                1.61.0

Expected behavior

There isn't any error.

Actual behavior

raise playwright._impl._errors.Error: Page.goto: Navigation to "about:blank" is interrupted by another navigation to "about:blank"

Additional context

In fact, it's so strange that the page only goto about:blank once, but it raises error navigation to the link while navigating to itself. I understand and it doesn't affect my service if navigating to new service when another one isn't complted. Is there any way to ignore this error?

Environment

- Operating System: [Windows 10 22H2]
- CPU: [amd64]
- Browser: [Firefox]
- Python Version: [3.12.13]
- uv: [0.11.29]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions