Bypass the External Protocol pop-up window during selenium automation

I run automation on Mac and ubunto (using cucumber, selenium web driver, junit)

during automation, I click the link with the non http protocol

The "External Protocol" popup will appear.

enter image description here

It blocks my test from testing the rest of the web page.

How can I easily get around it?

I thought, perhaps, to write a jar that does nothing, and then register it in this external protocol, but this will not help, since this pop-up window will still appear.

Maybe another browser can help?

Any other suggestions?

+5
source share
5

2 .

1) , ( ) ( "Local State" , "waze": false , "mailto", , ).

2) - ( algo, ):

  • "chrome://settings"
  • css "# advanced-settings-expander"
  • css "#privacyContentSettingsButton"
  • , css "# - [value = ]"
  • css selector "# content-settings-overlay-confirm"
+1

chromedriver . , -

driver.execute_script("window.confirm = function(msg) { return true; }")

prefs = {"protocol_handler.excluded_schemes":{"afp":True,"data":True,"disk":True,"disks":True,"file":True,"hcp":True,"intent":True, "itms-appss":True, "itms-apps":True,"itms":True,"market":True,"javascript":True,"mailto":True,"ms-help":True,"news":True,"nntp":True,"shell":True,"sip":True,"snews":False,"vbscript":True,"view-source":True,"vnd":{"ms":{"radio":True}}}}    

chrome_options.add_experimental_option("prefs",prefs)

, , "sip://"
"sip":True "protocol_handler.excluded_schemes"

+4

AutoIT ( Windows envrionment). *) ( 64- 32- ) *) Finder ( AutoIT v3), " "

: (700,430)

*) AutoIT ScriptEditor MouseClick ( "", "700 430) .au3.

*) script Runtime.getRuntime(). exec (" D:\AutoIt\AutoItTest.exe");

*) script.

0

, Javascript-selenium webdriverJS, . chromeOptions = { 'args': ['--test-type', '--start-maximized', 'use-fake-ui-for-media-stream',], 'prefs': { protocol_handler: { excluded_schemes: { 'iamlegend': false } } }, };

'iamlegend'

0

Firefox, # :

firefoxOptions.SetPreference("network.protocol-handler.external.your_custom_protocol", true);
firefoxOptions.SetPreference("network.protocol-handler.expose.your_custom_protocol", true);
firefoxOptions.SetPreference("network.protocol-handler.warn-external.your_custom_protocol", false);

Internet Explorer stores protocol handlers in the registry (works only for local WebDriver):

var baseKey = @"Software\Microsoft\Internet Explorer\ProtocolExecute\your_custom_protocol";
var protocolKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(baseKey, true) ?? Microsoft.Win32.Registry.CurrentUser.CreateSubKey(baseKey);

protocolKey?.SetValue("WarnOnOpen", 0, Microsoft.Win32.RegistryValueKind.DWord);
0
source

All Articles