I want to handle the notification popup in jabong website using selenium.
Asked
Active
Viewed 2,376 times
2

tsr_qa
- 633
- 3
- 9
- 27
-
Do you want to disable push notifications from this site or from all? – alecxe Sep 14 '16 at 12:57
-
@alecxe i want to disable from this website as well as when selenium script execution. – tsr_qa Sep 14 '16 at 13:03
-
@tsivarajan if you just want to dismiss the window clicking anywhere on the page that isn't the notification will make it go away. – Pseudo Sudo Sep 14 '16 at 13:07
1 Answers
5
You cannot control this kind of "popup" via Selenium directly.
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:
- manually open
jabong.com
and choose the desired push notification value - go to Help->Troubleshooting Information
- open the "Profile Folder" and copy path to it (or its name)
- load this profile when starting selenium driver
- manually open
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.