質問

I'm writing some selenium webdriver tests for a Facebook application. I'm running the tests in a Selenium Grid, and I'm seeing a problem when running in Opera (12.15). When the web app is launched in Facebook (or directly), Opera shows a page:

A page on the public internet requests data from your private intranet. For security reasons, automatic access is blocked, but you may choose to continue.

I have the option then to continue, or to always continue without being asked again. This works fine while I'm manually using the browser. But Selenium launches a new instance of the browser each time, so the preference needs to be selected again each time.

Is there a way to suppress this warning while the tests are running? A command line option? A DesiredCapability?

This seems like an issue that other people will have run into, but I can't find much, if anything, online.

役に立ちましたか?

解決

opera:config shows the option "Allow Cross Network Navigation", which is what you want. The permalink for it seems to link to opera:config#Network|AllowCrossNetworkNavigation, hence we want the preference in section Network, key AllowCrossNetworkNavigation and as it's displayed as a boolean preference it will take values 0 and 1.

The next issue is setting it programmatically: OperaDriver has a public OperaScopePreferences preferences() letting you do this (see OperaScopePreferences JavaDoc).

So, in short:

OperaDriver drv;
OperaScopePreferences prefs = drv.preferences();
prefs.set("Network", "AllowCrossNetworkNavigation", "1");

他のヒント

This does not work in Opera 33.0. opera:config has been replaced with opera://flags

After search for an hour, I've come to believe this setting no longer exists in any form within settings: opera:config#Network|AllowCrossNetworkNavigation

The closest I could find was: allow-insecure-localhost But that did not allow our project running on local host to allow-cross-network-navigation.

Also did some searches on "cross-network protection" no luck.

I'd say the correct solution for 2015 is to use firefox or chrome.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top