How to handle an unexpectedly closed browser? #3475
Answered
by
mdmintz
sebastianbrozda
asked this question in
Q&A
|
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! |
Answered by
mdmintz
Feb 4, 2025
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 |
3 replies
Answer selected by
mdmintz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
withblock 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.