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

[BUG] playwright._impl._api_types.Error: NS_BINDING_ABORTED; maybe frame was detached? #13640

Closed
simon-liebehenschel opened this issue Apr 19, 2022 · 9 comments

Comments

@simon-liebehenschel
Copy link

simon-liebehenschel commented Apr 19, 2022

Context

  • Playwright Version: 1.20
  • Operating System: Lubuntu 20.04
  • Python 3.10.4
  • Browser: Firefox

Traceback

Traceback (most recent call last):
  File "/home/joul/PycharmProjects/client/_local.py", line 51, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/joul/PycharmProjects/client/_local.py", line 23, in main
    await page.goto("https://example.com")
  File "/home/joul/.cache/pypoetry/virtualenvs/client-NboAmZt6-py3.10/lib/python3.10/site-packages/playwright/async_api/_generated.py", line 7581, in goto
    await self._async(
  File "/home/joul/.cache/pypoetry/virtualenvs/client-NboAmZt6-py3.10/lib/python3.10/site-packages/playwright/_impl/_page.py", line 493, in goto
    return await self._main_frame.goto(**locals_to_params(locals()))
  File "/home/joul/.cache/pypoetry/virtualenvs/client-NboAmZt6-py3.10/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 122, in goto
    await self._channel.send("goto", locals_to_params(locals()))
  File "/home/joul/.cache/pypoetry/virtualenvs/client-NboAmZt6-py3.10/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 39, in send
    return await self.inner_send(method, params, False)
  File "/home/joul/.cache/pypoetry/virtualenvs/client-NboAmZt6-py3.10/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 63, in inner_send
    result = next(iter(done)).result()
playwright._impl._api_types.Error: NS_BINDING_ABORTED; maybe frame was detached?
=========================== logs ===========================
navigating to "https://example.com/", waiting until "load"
============================================================

Process finished with exit code 1

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).

import asyncio

import playwright.async_api
from playwright.async_api import async_playwright


async def main():
    async with async_playwright() as p:
        browser = await p.firefox.launch()
        page = await browser.new_page()
        await page.goto("https://iecp.ru/news/item/429580-O-tipovom-kontrakte-na-postavku-lekarstvennyh-preparatov-dlya-medicinskogo-primeneniya")
        await page.goto("https://example.com")  # <-- This URL can be any real random URL.
        await browser.close()


asyncio.run(main())

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.

@yury-s
Copy link
Member

yury-s commented Apr 19, 2022

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

@simon-liebehenschel
Copy link
Author

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:

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.

@simon-liebehenschel
Copy link
Author

simon-liebehenschel commented Apr 20, 2022

Here is the playwright._impl._api_types.Error: Navigating frame was detached! error DEBUG logs:

error_log.tar.gz

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.

@yury-s
Copy link
Member

yury-s commented Apr 20, 2022

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.

@simon-liebehenschel
Copy link
Author

simon-liebehenschel commented Apr 21, 2022

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

It took time, but finally I've got logs:

2022-04-21T07:49:01.116Z pw:protocol ◀ RECV {"method":"Page.eventFired","params":{"frameId":"frame-35","name":"load"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.120Z pw:protocol SEND ► {"method":"Page.navigate","params":{"url":"https://www.eapteka.ru/goods/drugs/neurology/epilepsy/finlepsin_teva","frameId":"frame-35"},"id":15,"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.133Z pw:protocol ◀ RECV {"method":"Page.frameAttached","params":{"frameId":"frame-4294967303","parentFrameId":"frame-35"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.134Z pw:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"executionContextId":"id-25","auxData":{"frameId":"frame-4294967303","name":""}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.134Z pw:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"executionContextId":"id-26","auxData":{"frameId":"frame-4294967303","name":"__playwright_utility_world__"}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.136Z pw:protocol ◀ RECV {"method":"Page.navigationStarted","params":{"frameId":"frame-4294967303","navigationId":"850414262026268","url":"about:blank"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.139Z pw:protocol ◀ RECV {"method":"Page.frameAttached","params":{"frameId":"frame-4294967304","parentFrameId":"frame-35"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.140Z pw:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"executionContextId":"id-27","auxData":{"frameId":"frame-4294967304","name":""}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.140Z pw:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"executionContextId":"id-28","auxData":{"frameId":"frame-4294967304","name":"__playwright_utility_world__"}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.140Z pw:protocol ◀ RECV {"method":"Page.navigationStarted","params":{"frameId":"frame-4294967304","navigationId":"850414262026269","url":"about:srcdoc"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.146Z pw:protocol ◀ RECV {"method":"Page.navigationAborted","params":{"frameId":"frame-4294967303","navigationId":"850414262026268","errorText":"NS_BINDING_ABORTED"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.146Z pw:protocol ◀ RECV {"method":"Page.eventFired","params":{"frameId":"frame-4294967303","name":"DOMContentLoaded"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.147Z pw:protocol ◀ RECV {"method":"Page.eventFired","params":{"frameId":"frame-4294967303","name":"load"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.148Z pw:protocol ◀ RECV {"method":"Page.eventFired","params":{"frameId":"frame-4294967303","name":"load"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.148Z pw:protocol ◀ RECV {"method":"Page.navigationAborted","params":{"frameId":"frame-4294967304","navigationId":"850414262026269","errorText":"NS_BINDING_ABORTED"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.149Z pw:protocol ◀ RECV {"method":"Page.eventFired","params":{"frameId":"frame-4294967304","name":"DOMContentLoaded"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.149Z pw:protocol ◀ RECV {"method":"Page.eventFired","params":{"frameId":"frame-4294967304","name":"load"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.150Z pw:protocol ◀ RECV {"method":"Page.eventFired","params":{"frameId":"frame-4294967304","name":"load"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.150Z pw:protocol ◀ RECV {"method":"Page.navigationStarted","params":{"frameId":"frame-35","navigationId":"850414262026270","url":"https://www.eapteka.ru/goods/drugs/neurology/epilepsy/finlepsin_teva"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.156Z pw:protocol ◀ RECV {"id":15,"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58","result":{"navigationId":"850414262026270","navigationURL":"https://www.eapteka.ru/goods/drugs/neurology/epilepsy/finlepsin_teva"}}
2022-04-21T07:49:01.157Z pw:protocol ◀ RECV {"method":"Network.requestFailed","params":{"requestId":"850414262026267","errorCode":"NS_BINDING_ABORTED"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.160Z pw:protocol ◀ RECV {"method":"Network.requestWillBeSent","params":{"url":"https://www.eapteka.ru/goods/drugs/neurology/epilepsy/finlepsin_teva","frameId":"frame-35","isIntercepted":false,"requestId":"850414262026270","headers":[{"name":"Host","value":"www.eapteka.ru"},{"name":"User-Agent","value":"Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Firefox/98.0"},{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"},{"name":"Accept-Language","value":"en-US,en;q=0.5"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Connection","value":"keep-alive"},{"name":"Upgrade-Insecure-Requests","value":"1"},{"name":"Sec-Fetch-Dest","value":"document"},{"name":"Sec-Fetch-Mode","value":"navigate"},{"name":"Sec-Fetch-Site","value":"cross-site"}],"method":"GET","navigationId":"850414262026270","cause":"TYPE_DOCUMENT","internalCause":"TYPE_DOCUMENT"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.501Z pw:protocol ◀ RECV {"method":"Network.responseReceived","params":{"requestId":"850414262026270","securityDetails":{"protocol":"TLS 1.3","subjectName":"*.eapteka.ru","issuer":"RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1","validFrom":1597363200,"validTo":1660564800},"fromCache":false,"headers":[{"name":"server","value":"nginx-sp/"},{"name":"date","value":"Thu, 21 Apr 2022 07:4901 GMT"},{"name":"access-control-allow-origin","value":"*"},{"name":"connection","value":"keep-alive"},{"name":"keep-alive","value":"timeout=60"},{"name":"content-type","value":"text/html"},{"name":"transfer-encoding","value":"chunked"}],"remoteIPAddress":"185.169.155.28","remotePort":443,"status":200,"statusText":"OK","timing":{"startTime":1650527341155597,"domainLookupStart":1650527341160927,"domainLookupEnd":1650527341160983,"connectStart":1650527341161387,"secureConnectionStart":1650527341238909,"connectEnd":1650527341420158,"requestStart":1650527341420277,"responseStart":1650527341498031}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.514Z pw:protocol ◀ RECV {"method":"Runtime.executionContextDestroyed","params":{"executionContextId":"id-23"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.514Z pw:protocol ◀ RECV {"method":"Runtime.executionContextDestroyed","params":{"executionContextId":"id-24"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.515Z pw:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"executionContextId":"id-29","auxData":{"frameId":"frame-35","name":""}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.515Z pw:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"executionContextId":"id-30","auxData":{"frameId":"frame-35","name":"__playwright_utility_world__"}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.529Z pw:protocol ◀ RECV {"method":"Runtime.executionContextDestroyed","params":{"executionContextId":"id-25"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.530Z pw:protocol ◀ RECV {"method":"Runtime.executionContextDestroyed","params":{"executionContextId":"id-26"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.530Z pw:protocol ◀ RECV {"method":"Page.frameDetached","params":{"frameId":"frame-4294967303"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.530Z pw:protocol ◀ RECV {"method":"Runtime.executionContextDestroyed","params":{"executionContextId":"id-27"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.530Z pw:protocol ◀ RECV {"method":"Runtime.executionContextDestroyed","params":{"executionContextId":"id-28"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.531Z pw:protocol ◀ RECV {"method":"Page.frameDetached","params":{"frameId":"frame-4294967304"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.531Z pw:protocol ◀ RECV {"method":"Page.navigationCommitted","params":{"frameId":"frame-35","navigationId":"850414262026270","url":"https://www.eapteka.ru/goods/drugs/neurology/epilepsy/finlepsin_teva","name":""},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.540Z pw:protocol ◀ RECV {"method":"Network.requestWillBeSent","params":{"url":"https://cdnjs.cloudflare.com/ajax/libs/jsrsasign/8.0.20/jsrsasign-all-min.js","frameId":"frame-35","isIntercepted":false,"requestId":"850414262026272","headers":[{"name":"Host","value":"cdnjs.cloudflare.com"},{"name":"User-Agent","value":"Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Firefox/98.0"},{"name":"Accept","value":"*/*"},{"name":"Accept-Language","value":"en-US,en;q=0.5"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Connection","value":"keep-alive"},{"name":"Referer","value":"https://www.eapteka.ru/"},{"name":"Sec-Fetch-Dest","value":"script"},{"name":"Sec-Fetch-Mode","value":"no-cors"},{"name":"Sec-Fetch-Site","value":"cross-site"}],"method":"GET","cause":"TYPE_SCRIPT","internalCause":"TYPE_INTERNAL_SCRIPT_PRELOAD"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.541Z pw:protocol ◀ RECV {"method":"Network.requestWillBeSent","params":{"url":"https://cdn.jsdelivr.net/npm/@fingerprintjs/fingerprintjs@3/dist/fp.js","frameId":"frame-35","isIntercepted":false,"requestId":"850414262026273","headers":[{"name":"Host","value":"cdn.jsdelivr.net"},{"name":"User-Agent","value":"Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Firefox/98.0"},{"name":"Accept","value":"*/*"},{"name":"Accept-Language","value":"en-US,en;q=0.5"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Connection","value":"keep-alive"},{"name":"Referer","value":"https://www.eapteka.ru/"},{"name":"Sec-Fetch-Dest","value":"script"},{"name":"Sec-Fetch-Mode","value":"no-cors"},{"name":"Sec-Fetch-Site","value":"cross-site"}],"method":"GET","cause":"TYPE_SCRIPT","internalCause":"TYPE_INTERNAL_SCRIPT_PRELOAD"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.542Z pw:protocol ◀ RECV {"method":"Network.responseReceived","params":{"requestId":"850414262026272","securityDetails":{"protocol":"TLS 1.3","subjectName":"sni.cloudflaressl.com","issuer":"Cloudflare Inc ECC CA-3","validFrom":1632182400,"validTo":1663718399},"fromCache":true,"headers":[{"name":"date","value":"Thu, 21 Apr 2022 07:48:57 GMT"},{"name":"content-type","value":"application/javascript; charset=utf-8"},{"name":"content-length","value":"61839"},{"name":"access-control-allow-origin","value":"*"},{"name":"cache-control","value":"public, max-age=30672000"},{"name":"content-encoding","value":"br"},{"name":"etag","value":"\"5ef36711-4050b\""},{"name":"last-modified","value":"Wed, 24 Jun 2020 14:45:37 GMT"},{"name":"cf-cdnjs-via","value":"cfworker/kv"},{"name":"cross-origin-resource-policy","value":"cross-origin"},{"name":"timing-allow-origin","value":"*"},{"name":"x-content-type-options","value":"nosniff"},{"name":"expect-ct","value":"max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""},{"name":"vary","value":"Accept-Encoding"},{"name":"cf-cache-status","value":"HIT"},{"name":"age","value":"4984313"},{"name":"expires","value":"Tue, 11 Apr 2023 07:48:57 GMT"},{"name":"accept-ranges","value":"bytes"},{"name":"report-to","value":"{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=ub29rAjlq5nFgp6VaZT%2BNygG4cMQvpDsRBAspQ6RnlfqCGsPjJsguEVMnz%2B757bD9OkwlH5lJAxpNGSalJuXPXv2E9zjP3jQNq1m5Uodxuo%2BuJsJM8MFOOjfCPiEpgJWuhzvVdol\"}],\"group\":\"cf-nel\",\"max_age\":604800}"},{"name":"nel","value":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}"},{"name":"strict-transport-security","value":"max-age=15780000"},{"name":"server","value":"cloudflare"},{"name":"cf-ray","value":"6ff48532d99595b5-LUX"},{"name":"alt-svc","value":"h3=\":443\"; ma=86400, h3-29=\":443\"; ma=86400"},{"name":"X-Firefox-Spdy","value":"h2"}],"status":200,"statusText":"OK","timing":{"startTime":1650527341530829,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"secureConnectionStart":0,"connectEnd":0,"requestStart":0,"responseStart":0}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.545Z pw:protocol ◀ RECV {"method":"Network.requestFinished","params":{"requestId":"850414262026272","responseEndTime":0,"transferSize":0,"encodedBodySize":61839,"protocolVersion":"h2"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.546Z pw:protocol ◀ RECV {"method":"Network.responseReceived","params":{"requestId":"850414262026273","securityDetails":{"protocol":"TLS 1.3","subjectName":"jsdelivr.net","issuer":"GlobalSign Atlas R3 DV TLS CA 2022 Q1","validFrom":1647859815,"validTo":1682160614},"fromCache":true,"headers":[{"name":"alt-svc","value":"h3=\":443\";ma=86400,h3-29=\":443\";ma=86400,h3-27=\":443\";ma=86400"},{"name":"access-control-allow-origin","value":"*"},{"name":"access-control-expose-headers","value":"*"},{"name":"timing-allow-origin","value":"*"},{"name":"cache-control","value":"public, max-age=604800, s-maxage=43200"},{"name":"cross-origin-resource-policy","value":"cross-origin"},{"name":"x-content-type-options","value":"nosniff"},{"name":"strict-transport-security","value":"max-age=31536000; includeSubDomains; preload"},{"name":"content-type","value":"application/javascript; charset=utf-8"},{"name":"x-jsd-version","value":"3.3.3"},{"name":"x-jsd-version-type","value":"version"},{"name":"etag","value":"W/\"1c785-oz8mj8K14DWeQZYRVvSvYYw1Jys\""},{"name":"content-encoding","value":"gzip"},{"name":"accept-ranges","value":"bytes"},{"name":"date","value":"Thu, 21 Apr 2022 07:48:57 GMT"},{"name":"age","value":"43150"},{"name":"x-served-by","value":"cache-fra19127-FRA, cache-hhn4083-HHN"},{"name":"x-cache","value":"HIT, HIT"},{"name":"vary","value":"Accept-Encoding"},{"name":"content-length","value":"30057"},{"name":"X-Firefox-Spdy","value":"h2"}],"status":200,"statusText":"OK","timing":{"startTime":1650527341531100,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"secureConnectionStart":0,"connectEnd":0,"requestStart":0,"responseStart":0}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.547Z pw:protocol ◀ RECV {"method":"Network.requestFinished","params":{"requestId":"850414262026273","responseEndTime":0,"transferSize":0,"encodedBodySize":30057,"protocolVersion":"h2"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:01.576Z pw:protocol ◀ RECV {"method":"Network.requestFinished","params":{"requestId":"850414262026270","responseEndTime":1650527341575648,"transferSize":7411,"encodedBodySize":7059,"protocolVersion":"http/1.1"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.109Z pw:protocol ◀ RECV {"method":"Page.eventFired","params":{"frameId":"frame-35","name":"DOMContentLoaded"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.111Z pw:protocol ◀ RECV {"method":"Network.requestWillBeSent","params":{"url":"https://www.eapteka.ru/favicon.ico","frameId":"frame-35","isIntercepted":false,"requestId":"850414262026274","headers":[{"name":"Host","value":"www.eapteka.ru"},{"name":"User-Agent","value":"Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Firefox/98.0"},{"name":"Accept","value":"image/avif,image/webp,*/*"},{"name":"Accept-Language","value":"en-US,en;q=0.5"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Connection","value":"keep-alive"},{"name":"Referer","value":"https://www.eapteka.ru/goods/drugs/neurology/epilepsy/finlepsin_teva"},{"name":"Sec-Fetch-Dest","value":"image"},{"name":"Sec-Fetch-Mode","value":"no-cors"},{"name":"Sec-Fetch-Site","value":"joulne-origin"}],"method":"GET","cause":"TYPE_IMAGE","internalCause":"TYPE_INTERNAL_IMAGE_FAVICON"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.111Z pw:protocol ◀ RECV {"method":"Page.eventFired","params":{"frameId":"frame-35","name":"load"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.115Z pw:protocol SEND ► {"method":"Page.navigate","params":{"url":"https://www.eapteka.ru/rostov-na-donu/personal/cart","frameId":"frame-35"},"id":16,"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.119Z pw:protocol ◀ RECV {"method":"Network.requestFailed","params":{"requestId":"850414262026274","errorCode":"NS_BINDING_ABORTED"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.123Z pw:protocol ◀ RECV {"method":"Page.navigationStarted","params":{"frameId":"frame-35","navigationId":"850414262026275","url":"https://www.eapteka.ru/rostov-na-donu/personal/cart"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.126Z pw:protocol ◀ RECV {"id":16,"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58","result":{"navigationId":"850414262026275","navigationURL":"https://www.eapteka.ru/rostov-na-donu/personal/cart"}}
2022-04-21T07:49:02.127Z pw:protocol ◀ RECV {"method":"Page.frameAttached","params":{"frameId":"frame-4294967305","parentFrameId":"frame-35"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.129Z pw:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"executionContextId":"id-31","auxData":{"frameId":"frame-4294967305","name":""}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.130Z pw:protocol ◀ RECV {"method":"Network.requestWillBeSent","params":{"url":"https://www.eapteka.ru/rostov-na-donu/personal/cart","frameId":"frame-35","isIntercepted":false,"requestId":"850414262026275","headers":[{"name":"Host","value":"www.eapteka.ru"},{"name":"User-Agent","value":"Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Firefox/98.0"},{"name":"Accept","value":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"},{"name":"Accept-Language","value":"en-US,en;q=0.5"},{"name":"Accept-Encoding","value":"gzip, deflate, br"},{"name":"Connection","value":"keep-alive"},{"name":"Upgrade-Insecure-Requests","value":"1"},{"name":"Sec-Fetch-Dest","value":"document"},{"name":"Sec-Fetch-Mode","value":"navigate"},{"name":"Sec-Fetch-Site","value":"cross-site"}],"method":"GET","navigationId":"850414262026275","cause":"TYPE_DOCUMENT","internalCause":"TYPE_DOCUMENT"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.131Z pw:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"executionContextId":"id-32","auxData":{"frameId":"frame-4294967305","name":"__playwright_utility_world__"}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.131Z pw:protocol ◀ RECV {"method":"Page.navigationStarted","params":{"frameId":"frame-4294967305","navigationId":"850414262026276","url":"about:blank"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.139Z pw:protocol ◀ RECV {"method":"Page.frameAttached","params":{"frameId":"frame-4294967306","parentFrameId":"frame-35"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.140Z pw:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"executionContextId":"id-33","auxData":{"frameId":"frame-4294967306","name":""}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.141Z pw:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"executionContextId":"id-34","auxData":{"frameId":"frame-4294967306","name":"__playwright_utility_world__"}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.141Z pw:protocol ◀ RECV {"method":"Page.navigationStarted","params":{"frameId":"frame-4294967306","navigationId":"850414262026277","url":"about:srcdoc"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.161Z pw:protocol ◀ RECV {"method":"Page.navigationCommitted","params":{"frameId":"frame-4294967305","navigationId":"850414262026276","url":"about:blank","name":""},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.165Z pw:protocol ◀ RECV {"method":"Page.eventFired","params":{"frameId":"frame-4294967305","name":"DOMContentLoaded"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.335Z pw:protocol ◀ RECV {"method":"Runtime.executionContextDestroyed","params":{"executionContextId":"id-31"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.336Z pw:protocol ◀ RECV {"method":"Runtime.executionContextDestroyed","params":{"executionContextId":"id-32"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.336Z pw:protocol ◀ RECV {"method":"Page.frameDetached","params":{"frameId":"frame-4294967305"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.338Z pw:browser [pid=395863][err] JavaScript error: chrome://juggler/content/content/FrameTree.js, line 214: NS_NOINTERFACE: Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsIWebProgress.DOMWindow]
2022-04-21T07:49:02.340Z pw:protocol ◀ RECV {"method":"Page.navigationCommitted","params":{"frameId":"frame-4294967306","navigationId":"850414262026277","url":"about:srcdoc","name":""},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.345Z pw:protocol ◀ RECV {"method":"Page.eventFired","params":{"frameId":"frame-4294967306","name":"DOMContentLoaded"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.363Z pw:protocol ◀ RECV {"method":"Runtime.executionContextDestroyed","params":{"executionContextId":"id-33"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.363Z pw:protocol ◀ RECV {"method":"Runtime.executionContextDestroyed","params":{"executionContextId":"id-34"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.364Z pw:protocol ◀ RECV {"method":"Page.frameDetached","params":{"frameId":"frame-4294967306"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.426Z pw:protocol ◀ RECV {"method":"Runtime.console","params":{"args":[{"value":"decrypt"}],"type":"timeEnd","executionContextId":"id-29","location":{"lineNumber":40,"columnNumber":10,"url":"https://www.eapteka.ru/goods/drugs/neurology/epilepsy/finlepsin_teva"}},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.429Z pw:browser [pid=395863][err] JavaScript error: chrome://juggler/content/content/FrameTree.js, line 214: NS_NOINTERFACE: Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsIWebProgress.DOMWindow]
2022-04-21T07:49:02.429Z pw:protocol ◀ RECV {"method":"Network.requestFailed","params":{"requestId":"850414262026275","errorCode":"NS_BINDING_ABORTED"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.432Z pw:protocol ◀ RECV {"method":"Page.navigationAborted","params":{"frameId":"frame-35","navigationId":"850414262026275","errorText":"NS_BINDING_ABORTED"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.432Z pw:protocol ◀ RECV {"method":"Page.eventFired","params":{"frameId":"frame-35","name":"load"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.432Z pw:protocol ◀ RECV {"method":"Page.navigationStarted","params":{"frameId":"frame-35","navigationId":"850414262026278","url":"https://www.eapteka.ru/xpvnsulc/?back_location=https%3a%2f%2fwww.eapteka.ru%2fgoods%2fdrugs%2fneurology%2fepilepsy%2ffinlepsin_teva&options=d55bcf073b75337b3f2fc604837b4cde&hcheck=592b3f0038db87df8a1f0c42a5bba320&request_datetime=2022-04-21+07%3a49%3a01+%2b0000&request_ip=92.223.89.195&request_id=1nVR53ChF8c1"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}
2022-04-21T07:49:02.434Z pw:browser [pid=395863] <gracefully close start>
2022-04-21T07:49:03.026Z pw:browser [pid=395863] <process did exit: exitCode=0, signal=null>
2022-04-21T07:49:03.027Z pw:browser [pid=395863] starting temporary directories cleanup
2022-04-21T07:49:03.057Z pw:browser [pid=395863] finished temporary directories cleanup
2022-04-21T07:49:03.058Z pw:browser [pid=395863] <gracefully close end>
Traceback (most recent call last):
  File "/home/jouln/PycharmProjects/client/_local.py", line 60, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/jouln/PycharmProjects/client/_local.py", line 35, in main
    await page.goto(url, timeout=120_000)
  File "/home/jouln/.cache/pypoetry/virtualenvs/client-NboAmZt6-py3.10/lib/python3.10/site-packages/playwright/async_api/_generated.py", line 7581, in goto
    await self._async(
  File "/home/jouln/.cache/pypoetry/virtualenvs/client-NboAmZt6-py3.10/lib/python3.10/site-packages/playwright/_impl/_page.py", line 493, in goto
    return await self._main_frame.goto(**locals_to_params(locals()))
  File "/home/jouln/.cache/pypoetry/virtualenvs/client-NboAmZt6-py3.10/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 122, in goto
    await self._channel.send("goto", locals_to_params(locals()))
  File "/home/jouln/.cache/pypoetry/virtualenvs/client-NboAmZt6-py3.10/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 39, in send
    return await self.inner_send(method, params, False)
  File "/home/jouln/.cache/pypoetry/virtualenvs/client-NboAmZt6-py3.10/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 63, in inner_send
    result = next(iter(done)).result()
playwright._impl._api_types.Error: NS_BINDING_ABORTED; maybe frame was detached?
=========================== logs ===========================
navigating to "https://www.eapteka.ru/rostov-na-donu/personal/cart", waiting until "load"
============================================================

Process finished with exit code 1

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.
My proposal is to catch the NS_BINDING_ABORTED; maybe frame was detached? error and show a RuntimeWarning or log the error.
When it comes to the web testing, on my opinion, Playwright must be as stable as a non-automated browser. But now, sadly, the Playwright is not stable and every time when I just open another URL in an already opened tab, I must cross my fingers with a hope that the Playwright will not crash.

@yury-s
Copy link
Member

yury-s commented Apr 22, 2022

There are two concurrent navigations in the log:
first one:

2022-04-21T07:49:01.120Z pw:protocol SEND ► {"method":"Page.navigate","params":{"url":"https://www.eapteka.ru/goods/drugs/neurology/epilepsy/finlepsin_teva","frameId":"frame-35"},"id":15,"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}

And before it is finished another one starts interrupting the first one and leading to NS_BINDING_ABORTED errors:

2022-04-21T07:49:02.115Z pw:protocol SEND ► {"method":"Page.navigate","params":{"url":"https://www.eapteka.ru/rostov-na-donu/personal/cart","frameId":"frame-35"},"id":16,"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}

and after that another one starts (apparently initiated by the page):

2022-04-21T07:49:02.432Z pw:protocol ◀ RECV {"method":"Page.navigationStarted","params":{"frameId":"frame-35","navigationId":"850414262026278","url":"https://www.eapteka.ru/xpvnsulc/?back_location=https%3a%2f%2fwww.eapteka.ru%2fgoods%2fdrugs%2fneurology%2fepilepsy%2ffinlepsin_teva&options=d55bcf073b75337b3f2fc604837b4cde&hcheck=592b3f0038db87df8a1f0c42a5bba320&request_datetime=2022-04-21+07%3a49%3a01+%2b0000&request_ip=92.223.89.195&request_id=1nVR53ChF8c1"},"sessionId":"57c5bb61-01b3-4b65-b59a-1407737eaf58"}

which aborts the previous navigation. It all seems to be working as intended.

Can you shared the actual snippet that produced this logs?

@simon-liebehenschel
Copy link
Author

simon-liebehenschel commented Apr 23, 2022

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.


and after that another one starts (apparently initiated by the page):

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.

@pavelfeldman
Copy link
Member

What if Playwright will abort silently the navigation caused by a webpage if another navigation was started from the code?

This is already happening. But in your case, it seems that the page-initiated navigation happens after the page.goto.

@pavelfeldman
Copy link
Member

Closing as per above, please feel free to open a new issue if this does not cover your use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants