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");