How to handle SSL certificates in chrome using Selenium?



  • enter image description hereI am trying to post something on facebook using selenium. But after successfully logged in, i am getting SSL certificate to allow or block the notification of Facebook. I am not aware how to handle that, it is not an alert, not sure how to select block or close SSL, and continue automating the web page. I'd really appreciate the help here.

    DesiredCapabilities handlSSLErr = DesiredCapabilities.chrome ()       
    handlSSLErr.setCapability (CapabilityType.ACCEPT_SSL_CERTS, true)
    WebDriver driver = new ChromeDriver (handlSSLErr);
    


  • This isn't actually related to SSL certificates , notifications is something else.

    If you don't intend to use them turn them off

    You can have the browser started with them disabled by adding

    --disable-notifications

    to the browser command line via chrome options.

    This can be done programmatically as follows

    ChromeOptions options = new ChromeOptions();
    options.addArguments("disable-notifications");
    

    You can find docs for this here http://chromedriver.chromium.org/capabilities

    Doing this will might weaken your testing as most people have them enabled. That said, I have yet to find a website that i trust with this power and should probably set this on my actual browser.



Suggested Topics