I just spend a few hours on this, so here’s a quick public not for anyone trying to do selenium testing on Microsoft Edge Chromium that runs into a popup for custom uri-handlers:
You can disable them by passing the following code-block as experimental options in microsoft edge.
1 2 3 4 5 6 7 8 |
{ "protocol_handler": { "allowed_origin_protocol_pairs": { "https://www.ivojonker.nl.nl": { "myUriHandler": true } } } } |
Here’s my proof of concept / quick and dirty implementation in java:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
EdgeDriver driver = null; EdgeOptions opt=new EdgeOptions(); String protocolHandlerSetting=" {\"protocol_handler\": {\r\n" + " \"allowed_origin_protocol_pairs\": {\r\n" + " \"https://www.ivojonker.nl\": {\r\n" + " \"myUriHandler\": true\r\n" + " }\r\n" + " }\r\n" + " }}"; opt.setExperimentalOption("prefs", new Gson().fromJson(protocolHandlerSetting, HashMap.class)); driver = new EdgeDriver(opt); driver.get("https://www.ivojonker.nl"); |
Enjoy!