-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[BUG] playwright._impl._api_types.Error: NS_BINDING_ABORTED; maybe frame was detached? #13640
Comments
I can't reproduce it. Could you run it with DEBUG=pw:browser*,pw:protocol and share the logs when it fails? Something like this: while DEBUG=pw:browser*,pw:protocol python test.py; do echo "next"; done |
I see that the error happens randomly for random URLs. I am requesting now random URLs one by one to get the error again. I will give you DEBUG logs as soon as I get the error again. |
Here is the I am not sure whether this error related or not. Maybe I will need to create a separate issue for it. I will continue requesting random URLs to get exactly the same error as in the issue description. |
The error happens because navigation or more precisely network request in this case is interrupted by another navigation. The root cause is the same as in #13653 and #13651 that you filed - the page lives its own live and starts navigation while you concurrently navigate it to another url with page.goto. |
It took time, but finally I've got logs:
Real browsers (not automated) that you use to serf the web in your regular life do not crash during simple URLs opening, maybe except some extreme rare cases. |
There are two concurrent navigations in the log:
And before it is finished another one starts interrupting the first one and leading to
and after that another one starts (apparently initiated by the page):
which aborts the previous navigation. It all seems to be working as intended. Can you shared the actual snippet that produced this logs? |
All last issues that I opened in this repository were result of a simple code when I open a browser page and use the page to request URLs one by one: from playwright.async_api import async_playwright
async with async_playwright() as p:
browser = await p.firefox.launch()
page = await browser.new_page()
for url in my_urls_list:
await page.goto(url)
await browser.close() Based on this logs, probably URLs were (I am not sure, please double check the log): from playwright.async_api import async_playwright
urls = [
"https://www.eapteka.ru/goods/drugs/neurology/epilepsy/finlepsin_teva",
"https://www.eapteka.ru/rostov-na-donu/personal/cart",
]
async with async_playwright() as p:
browser = await p.firefox.launch()
page = await browser.new_page()
for url in my_urls_list:
await page.goto(url)
await browser.close() But as you already said and as I tested, the error is not persistent for the same URLs. In other words, if we will take some URLs from my logs that I sent and we try to request them again, then no guaranties to get the same error.
Maybe this is the problem! If so, it would be great to handle this in some way. Right now it is not clear how to make Playwright to be as stable as a non-automated regular web browser. What if Playwright will abort silently the navigation caused by a webpage if another navigation was started from the code? For example, imagine that you use your web browser: you copy/paste a URL in the search bar, you click "Enter". Your web browser will abort/stop that webpage and the browser will go to the new URL your entered. |
This is already happening. But in your case, it seems that the page-initiated navigation happens after the page.goto. |
Closing as per above, please feel free to open a new issue if this does not cover your use case. |
Context
Traceback
Code
!!! IMPORTANT - READ BEFORE YOU WILL RUN THE EXAMPLE !!!
The bug appears randomly on every 2nd or 3rd execution (maybe it depends on internet speed or other random factors).
Related bugs
https://github.com/microsoft/playwright/issues?q=NS_BINDING_ABORTED
The bug was never solved. People either did not show a reproducible code sample or the Playwright maintainers were not able to reproduce the bug. Let's finally solve this problem!
Workaround (temporary local solution)
Thanks for this guy for a workaround: #2061 (comment)
The workaround is sleep for a small time between
page.goto()
calls.The text was updated successfully, but these errors were encountered: