playwright.helper.Error: Execution context was destroyed, most likely because of a navigation
See original GitHub issueenvironment
Python==3.8.0 playwright==0.162.2
code
from playwright import sync_playwright
with sync_playwright() as playwright:
browser = playwright.chromium.launch(headless=False)
context = browser.newContext()
page = context.newPage()
page.goto(url)
button_exists = page.querySelector('button[name="glowDoneButton"]')
error img
detail error log
(node:32864) UnhandledPromiseRejectionWarning: Error: EPIPE: broken pipe, write
at Socket._write (internal/net.js:54:25)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at Transport.send (C:\snapshot\playwright-cli\node_modules\playwright\lib\protocol\transport.js:38:25)
at DispatcherConnection.onmessage (C:\snapshot\playwright-cli\lib\driver.js:49:61)
at DispatcherConnection.sendMessageToClient (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:129:14)
at PageDispatcher._dispatchEvent (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:70:26)
at Page.<anonymous> (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\pageDispatcher.js:69:63)
at Page.emit (events.js:315:20)
(node:32864) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:32864) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:32864) UnhandledPromiseRejectionWarning: Error: EPIPE: broken pipe, write
at Socket._write (internal/net.js:54:25)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at Transport.send (C:\snapshot\playwright-cli\node_modules\playwright\lib\protocol\transport.js:38:25)
at DispatcherConnection.onmessage (C:\snapshot\playwright-cli\lib\driver.js:49:61)
at DispatcherConnection.sendMessageToClient (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:129:14)
at PageDispatcher._dispatchEvent (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:70:26)
at Page.<anonymous> (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\pageDispatcher.js:65:71)
at Page.emit (events.js:315:20)
(node:32864) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:32864) UnhandledPromiseRejectionWarning: Error: EPIPE: broken pipe, write
at Socket._write (internal/net.js:54:25)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at Transport.send (C:\snapshot\playwright-cli\node_modules\playwright\lib\protocol\transport.js:38:25)
at DispatcherConnection.onmessage (C:\snapshot\playwright-cli\lib\driver.js:49:61)
at DispatcherConnection.sendMessageToClient (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:129:14)
at new Dispatcher (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:61:30)
at new RequestDispatcher (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\networkDispatchers.js:32:9)
at Function.from (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\networkDispatchers.js:25:26)
(node:32864) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:32864) UnhandledPromiseRejectionWarning: Error: EPIPE: broken pipe, write
at Socket._write (internal/net.js:54:25)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at Transport.send (C:\snapshot\playwright-cli\node_modules\playwright\lib\protocol\transport.js:38:25)
at DispatcherConnection.onmessage (C:\snapshot\playwright-cli\lib\driver.js:49:61)
at DispatcherConnection.sendMessageToClient (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:129:14)
at new Dispatcher (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:61:30)
at new ResponseDispatcher (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\networkDispatchers.js:50:9)
at Page.<anonymous> (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\pageDispatcher.js:69:102)
(node:32864) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
(node:32864) UnhandledPromiseRejectionWarning: Error: EPIPE: broken pipe, write
at Socket._write (internal/net.js:54:25)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at Transport.send (C:\snapshot\playwright-cli\node_modules\playwright\lib\protocol\transport.js:38:25)
at DispatcherConnection.onmessage (C:\snapshot\playwright-cli\lib\driver.js:49:61)
at DispatcherConnection.sendMessageToClient (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:129:14)
at PageDispatcher._dispatchEvent (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:70:26)
at Page.<anonymous> (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\pageDispatcher.js:65:71)
at Page.emit (events.js:315:20)
(node:32864) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
(node:32864) UnhandledPromiseRejectionWarning: Error: EPIPE: broken pipe, write
at Socket._write (internal/net.js:54:25)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at Transport.send (C:\snapshot\playwright-cli\node_modules\playwright\lib\protocol\transport.js:38:25)
at DispatcherConnection.onmessage (C:\snapshot\playwright-cli\lib\driver.js:49:61)
at DispatcherConnection.sendMessageToClient (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:129:14)
at new Dispatcher (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:61:30)
at new RequestDispatcher (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\networkDispatchers.js:32:9)
at Function.from (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\networkDispatchers.js:25:26)
(node:32864) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)
(node:32864) UnhandledPromiseRejectionWarning: Error: EPIPE: broken pipe, write
at Socket._write (internal/net.js:54:25)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at Transport.send (C:\snapshot\playwright-cli\node_modules\playwright\lib\protocol\transport.js:38:25)
at DispatcherConnection.onmessage (C:\snapshot\playwright-cli\lib\driver.js:49:61)
at DispatcherConnection.sendMessageToClient (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:129:14)
at new Dispatcher (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:61:30)
at new ResponseDispatcher (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\networkDispatchers.js:50:9)
at Page.<anonymous> (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\pageDispatcher.js:69:102)
(node:32864) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 7)
(node:32864) UnhandledPromiseRejectionWarning: Error: EPIPE: broken pipe, write
at Socket._write (internal/net.js:54:25)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at Transport.send (C:\snapshot\playwright-cli\node_modules\playwright\lib\protocol\transport.js:38:25)
at DispatcherConnection.onmessage (C:\snapshot\playwright-cli\lib\driver.js:49:61)
at DispatcherConnection.sendMessageToClient (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:129:14)
at PageDispatcher._dispatchEvent (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:70:26)
at Page.<anonymous> (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\pageDispatcher.js:65:71)
at Page.emit (events.js:315:20)
(node:32864) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
(node:32864) UnhandledPromiseRejectionWarning: Error: EPIPE: broken pipe, write
at Socket._write (internal/net.js:54:25)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at Transport.send (C:\snapshot\playwright-cli\node_modules\playwright\lib\protocol\transport.js:38:25)
at DispatcherConnection.onmessage (C:\snapshot\playwright-cli\lib\driver.js:49:61)
at DispatcherConnection.sendMessageToClient (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:129:14)
at new Dispatcher (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:61:30)
at new RequestDispatcher (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\networkDispatchers.js:32:9)
at Function.from (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\networkDispatchers.js:25:26)
(node:32864) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
(node:32864) UnhandledPromiseRejectionWarning: Error: EPIPE: broken pipe, write
at Socket._write (internal/net.js:54:25)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at Transport.send (C:\snapshot\playwright-cli\node_modules\playwright\lib\protocol\transport.js:38:25)
at DispatcherConnection.onmessage (C:\snapshot\playwright-cli\lib\driver.js:49:61)
at DispatcherConnection.sendMessageToClient (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:129:14)
at PageDispatcher._dispatchEvent (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\dispatcher.js:70:26)
at Page.<anonymous> (C:\snapshot\playwright-cli\node_modules\playwright\lib\dispatchers\pageDispatcher.js:42:18)
at Page.emit (events.js:315:20)
(node:32864) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 10)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Execution context was destroyed, most likely because of a ...
I have a website with unpredictable behaviour when a form is submitted, it can show me a message or it redirects me to...
Read more >Puppeteer Execution context was destroyed, most likely ...
The error means that you are accessing data which has become obsolete/invalid because of navigation. In your script the error references the ...
Read more >Puppeteer: "Execution context was destroyed, most likely ...
To fix the “execution context was destroyed, most likely because of a navigation” error, use the page.waitForNavigation() function: const ...
Read more >playwright._impl._api_types.error: execution context was ...
To fix the “execution context was destroyed, most likely because of a navigation” error, use the page.waitForNavigation () function: The page.waitForNavigation ...
Read more >Puppeteer – Execution context was destroyed, most likely ...
Puppeteer – Execution context was destroyed, most likely because of a navigation – Daily IT Help.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey guys! I have also seen a similar issue while executing playwright with java: Trying to execute this script: page.waitForLoadState(); Error log: node:events:368 throw er; // Unhandled ‘error’ event ^
Error: EPIPE: broken pipe, write at Socket._write (node:internal/net:55:25) at writeOrBuffer (node:internal/streams/writable:389:12) at _write (node:internal/streams/writable:330:10) at Socket.Writable.write (node:internal/streams/writable:334:10) at Transport.send (C:\Users\NIGORA~1.MAM\AppData\Local\Temp\playwright-java-3251920591875641209\package\lib\protocol\transport.js:54:21) at DispatcherConnection.dispatcherConnection.onmessage (C:\Users\NIGORA~1.MAM\AppData\Local\Temp\playwright-java-3251920591875641209\package\lib\cli\driver.js:67:57) at DispatcherConnection.sendMessageToClient (C:\Users\NIGORA~1.MAM\AppData\Local\Temp\playwright-java-3251920591875641209\package\lib\dispatchers\dispatcher.js:187:10) at BrowserContextDispatcher._dispatchEvent (C:\Users\NIGORA~1.MAM\AppData\Local\Temp\playwright-java-3251920591875641209\package\lib\dispatchers\dispatcher.js:108:22) at CRBrowserContext.<anonymous> (C:\Users\NIGORA~1.MAM\AppData\Local\Temp\playwright-java-3251920591875641209\package\lib\dispatchers\browserContextDispatcher.js:115:16) at CRBrowserContext.emit (node:events:390:28) Emitted ‘error’ event on Socket instance at: at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) at runNextTicks (node:internal/process/task_queues:65:3) at processImmediate (node:internal/timers:437:9) { errno: -4047, syscall: ‘write’, code: ‘EPIPE’ } The batch file cannot be found. The batch file cannot be found.
today I am face the same issue , I try to set
DEBUG=pw:browser*
, but the bug information is similarmy code is more than 1000 lines , so to get the minimum bug code is hard .
and some information maybe helpful
python -m test.test_new.test_cpu
it will be have two kind A, stop and no information at the first B. give some bug information like up