tsr_qa
tsr_qa

Reputation: 633

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

enter image description here

I want to handle the notification popup in jabong website using selenium.

Upvotes: 2

Views: 2498

Answers (1)

alecxe
alecxe

Reputation: 473833

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:

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.

Upvotes: 5

Related Questions