本文介绍了处理Python + Selenium Chrome WebDriver中的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用Python处理Selenium Chrome WebDriver通知?
How can Selenium Chrome WebDriver notifications be handled in Python?
曾尝试关闭/接受alert和active element,但似乎必须以其他方式处理通知.另外,所有的Google搜索结果都将我带到了我真正不需要的Java解决方案.我是Python的新手.
Have tried to dismiss/accept alert and active element but seems notifications have to be treated other way. Also, all the Google search results are driving me to Java solution which I do not really need. I'm a newbie in Python.
谢谢.
推荐答案
您可以使用chrome选项禁用浏览器通知.
You can disable the browser notifications, using chrome options.
chrome_options = webdriver.ChromeOptions() prefs = {"profile.default_content_setting_values.notifications" : 2} chrome_options.add_experimental_option("prefs",prefs) driver = webdriver.Chrome(chrome_options=chrome_options)更多推荐
处理Python + Selenium Chrome WebDriver中的通知
发布评论