Pre-run executables are commonly used to change browser settings and VM configurations before a test starts. This page provides a few examples these scripts, and covers setting
prerun as a desired capability during test configuration. You can find more information on the
prerun capability in Test Configuration Options.
Root and Administrative Permissions on Sauce Labs Virtual Machines
Note that sudo access is not allowed on Linux/Mac virtual machines. Administrative access is not allowed on Windows VMs.
Write a configuration script to enact changes to the browser or VM
This example script disables the Warning that Safari pops up when using basic HTTP authentication to access a website.
Match File Types to Your Operating System
When creating your executable file, take into account the operating system you'll use for your tests. For example, Bash commands won't work on Windows machines, which instead require a
Store your configuration script in a location where Sauce can access it
For example, your script could be stored in GitHub or in . You can also use Gist to easily host your executable file. Make sure to use the link containing the raw file contents.
prerun capability In your test script to the location of your pre-run executable
This example sets
prerun to point to
myscriptstorage.com, whch hosts the script
disable_fraud.sh used as an example in step 1.
This example accesses the same script from Sauce Storage:
Run your test.
The prerun script will download to your Sauce Labs VM and execute prior to the test itself.