Search code examples
javatestingseleniumselenium-webdriverwebdriver

Bypass "External protocol request" popup during selenium automation


I'm running an automation on mac and on ubunto (using cucumber, selenium web driver, junit)

during the automation I click a link with non http protocol

an "External protocol request" popup appears.

enter image description here

It blocks my test from testing the rest of the webpage.

How can I bypass it easily?

I have thought maybe to write a jar that does nothing and then register it to this external protocol, but it won't help as this popup will still appear.

Maybe using another browser can help?

Any other suggestions?


Solution

  • You have 2 possible options.

    1) Is running a chrome with a predefined profile, where you have disabled protocol handling manually (via interface or config file) ("Local State" file in profile settings, you should add "waze": false in the appropriate section, you can search for "mailto" to know where is it).

    2) Another way is to put put the setting in your tests' constructor before all your tests will start (I'll write an algo, because it depends on your framework and language):

    • navigate to "chrome://settings"
    • press link with css selector "#advanced-settings-expander"
    • press button with css selector "#privacyContentSettingsButton"
    • press label with the needed option using css selector "#handlers-section input[value=block]"
    • press done via css selector "#content-settings-overlay-confirm"