如何使用Selenium Webdriver处理浏览器级别的通知 [英] How to handle browser level notification using Selenium Webdriver
本文介绍了如何使用Selenium Webdriver处理浏览器级别的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Selenium Webdriver和核心Java自动化一些测试用例,在Chrome浏览器中点击一个测试用例点击按钮我正在获得浏览器级别通知'显示带有选项允许和阻止的通知'。我想选择允许选项。谁能知道如何使用Selenium webdriver处理这种通知。
请参阅以下快照了解更多详情
I am Automating some test cases using Selenium Webdriver and core Java,in chrome browser for one test case on clicking button I am getting browser level notification 'Show notifications with options Allow and Block'. I want to select Allow option. Can anyone know how to handle this kind of notifications using Selenium webdriver. please refer following snapshot for more details
推荐答案
WebDriver driver ;
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("permissions.default.desktop-notification", 1);
DesiredCapabilities capabilities=DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
driver = new FirefoxDriver(capabilities);
driver.get("your Web site");
这篇关于如何使用Selenium Webdriver处理浏览器级别的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文