{"id":737,"date":"2021-03-24T17:23:16","date_gmt":"2021-03-24T16:23:16","guid":{"rendered":"http:\/\/h2916922.stratoserver.net:8084\/?p=737"},"modified":"2021-03-24T17:30:40","modified_gmt":"2021-03-24T16:30:40","slug":"selenium-edgedriver-allow-custom-protocol_handler","status":"publish","type":"post","link":"https:\/\/www.ivojonker.nl\/?p=737","title":{"rendered":"Configure Selenium EdgeDriver to prevent uri\/protocol_handler popups."},"content":{"rendered":"\n<p>I just spend a few hours on this, so here&#8217;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:<\/p>\n\n\n\n<p>You can disable them by passing the following code-block as experimental options in microsoft edge.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\t\"protocol_handler\": {\n\t\t\"allowed_origin_protocol_pairs\": {\n\t\t\t\"http:\/\/h2916922.stratoserver.net:8084.nl\": {\n\t\t\t\t\"myUriHandler\": true\n\t\t\t}\n\t\t}\n\t}\n}<\/code><\/pre>\n\n\n\n<p>Here&#8217;s my proof of concept \/ quick and dirty implementation in java:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\t\tEdgeDriver driver = null;\n\t\tEdgeOptions opt=new EdgeOptions();\n\n\t\tString protocolHandlerSetting=\"\t{\\\"protocol_handler\\\": {\\r\\n\"\n\t\t\t+ \"\t\t\\\"allowed_origin_protocol_pairs\\\": {\\r\\n\"\n\t\t\t+ \"\t\t\t\\\"http:\/\/h2916922.stratoserver.net:8084\\\": {\\r\\n\"\n\t\t\t+ \"\t\t\t\t\\\"myUriHandler\\\": true\\r\\n\"\n\t\t\t+ \"\t\t\t}\\r\\n\"\n\t\t\t+ \"\t\t}\\r\\n\"\n\t\t\t+ \"\t}}\";\n\t\t\n\t\topt.setExperimentalOption(\"prefs\", new Gson().fromJson(protocolHandlerSetting, HashMap.class));\n\t\t\n\t\tdriver = new EdgeDriver(opt);\n\t\tdriver.get(\"http:\/\/h2916922.stratoserver.net:8084\");<\/code><\/pre>\n\n\n\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just spend a few hours on this, so here&#8217;s a quick public not for anyone trying to do selenium testing on Microsoft Edge Chromium that runs into a popup [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-737","post","type-post","status-publish","format-standard","hentry","category-geen-categorie"],"_links":{"self":[{"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/posts\/737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=737"}],"version-history":[{"count":2,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/posts\/737\/revisions"}],"predecessor-version":[{"id":739,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/posts\/737\/revisions\/739"}],"wp:attachment":[{"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}