简体   繁体   English

如何使用Java处理Selenium中的浏览器通知弹出窗口?

[英]How to handle the browser notification popup in selenium using java?

在此处输入图片说明

I want to handle the notification popup in jabong website using selenium. 我想使用硒处理jabong网站中的通知弹出窗口。

You cannot control this kind of "popup" via Selenium directly. 您不能通过Selenium直接控制这种“弹出窗口”。

What you can do is to: 您可以做的是:

  • disable all push notifications for the browser session entirely: 完全禁用浏览器会话的所有推送通知

     FirefoxProfile ffprofile = new FirefoxProfile(); ffprofile.setPreference("dom.webnotifications.enabled", false); WebDriver driver = new FirefoxDriver(ffprofile); 
  • load the existing profile in which you had pre-set up the desired behavior for the push notifications for this site: 加载现有的配置文件,在该配置文件中您已为此网站的推送通知预先设置了所需的行为:

FYI, when you configure push notifications in the browser, Firefox inserts/updates a site-specific record inside permissions.sqlite SQLite database file which you can find inside the profile directory. 仅供参考,当您在浏览器中配置推送通知时,Firefox会在profile。目录中的permissions.sqlite SQLite数据库文件内插入/更新特定于站点的记录。

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

相关问题 如何使用 Java 使用 Selenium WebDriver 处理 Firefox 中的身份验证弹出窗口 - How to handle authentication popup in Firefox with Selenium WebDriver using Java 如何在Java中使用Selenium访问弹出元素 - How to access popup elements using Selenium in Java 如何使用Selenium chromedriver处理地理位置弹出窗口? - How to handle Geo location popup using Selenium chromedriver? 如何在Selenium WebDriver中处理Safari浏览器的警报? - How to handle alert for Safari browser in selenium webdriver? 如何使用Selenium处理两次进入检查Java脚本提示 - How to handle double entry check java script prompt using selenium 如何防止浏览器调用基本的auth弹出窗口并使用Jquery处理401错误? - How to prevent browser to invoke basic auth popup and handle 401 error using Jquery? 如何防止浏览器调用Digest auth弹出窗口并使用Jquery处理401错误? - How to prevent browser to invoke Digest auth popup and handle 401 error using Jquery? 如何使用 selenium 和 java 捕获浏览器控制台日志 - How can i capture Browser console log using selenium and java 如何接受“此操作无法撤消。 您确定要使用 Selenium 和 Java 删除此愿望清单吗? - How to accept “This action cannot be undone. Are you sure you want to delete this wishlist” popup using Selenium and Java 如何使用 WebSocket 处理实时通知? - How to handle real time notification using WebSocket?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM