How to handle an unexpectedly closed browser? #3475
-
Hi,
When the script is waiting for my input, I manually close the browser and then press How can I handle this situation? I'd like to detect that the browser was closed unexpectedly and restart it if needed. Best regards! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The browser wouldn't close unexpectedly in CDP Mode unless you manually closed it. If you wanted to close the browser, you would first call Also, you may want to use a Python |
Beta Was this translation helpful? Give feedback.
The browser wouldn't close unexpectedly in CDP Mode unless you manually closed it.
If you wanted to close the browser, you would first call
sb.reconnect()
and thensb.driver.quit()
.But it's probably better to wait until the end of the
with
block for the automatic browser quit / close.Also, you may want to use a Python
breakpoint()
instead ofinput()
if you're just trying to pause the script.