The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing


External Resources

More Info

Page tree
Skip to end of metadata
Go to start of metadata

In Safari, when you try to navigate to a URL that uses basic HTTP authentication, a warning dialog pops up that will derail your automated tests unless you can resolve it. You can use a short shell script that you execute as a pre-run executable to configure Safari to not show this message.

Safari Versions

 You can only use this for Safari versions up to and including 10.x.

The Script

defaults write WarnAboutFraudulentWebsites false

This script clears the Warn when visiting a fraudulent website option in Safari's preferences, so that your automated tests that use basic authentication over HTTP will execute without triggering the warning. 

This script is hosted as a Gist on GitHub:

Setting the prerun Capability

You can host this script in your own repository, or in temporary Sauce Storage, and refer to it within the prerun capability of your tests as described in the Test Configuration Options topic. This Python example refers to the GitHub Gist location:

desired_capabilities['prerun'] = { 
    'background': 'false'