在 Python + Selenium Chrome WebDriver 中处理通知

编程入门 行业动态 更新时间:2024-10-10 01:26:00
本文介绍了在 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 中处理通知

本文发布于:2023-11-27 16:22:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1638731.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:通知   Selenium   Python   WebDriver   Chrome

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!