[英]How to handle the browser notification popup in selenium using java?
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: 加载现有的配置文件,在该配置文件中您已为此网站的推送通知预先设置了所需的行为:
jabong.com
and choose the desired push notification value jabong.com
并选择所需的推送通知值 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.