简体   繁体   English

python中的selenium,如何在不关闭浏览器的情况下忽略错误

[英]selenium in python, how to ignore errors without closing the browser

I'm doing an automation using Selenium in Python我在 Python 中使用 Selenium 进行自动化

How could I simply ignore an error that happens on the site without it closing the browser?我怎么能在不关闭浏览器的情况下简单地忽略网站上发生的错误?

I looked in several places about and I didn't find anything that helped me我看了好几个地方,但没有找到任何对我有帮助的东西

You can do:你可以做:

# Needed libs
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_experimental_option("detach", True)
driver = webdriver.Chrome(options=chrome_options)

Then, if something fails, your browser will not be closed.然后,如果出现故障,您的浏览器将不会关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM