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

This test assumes you have set your Sauce Labs authentication credentials as environment variables

You can also clone this script directly from GitHub.

Authentication over HTTP instead of HTTPS

Unlike other languages, the Selenium bindings for Python don't support connecting over HTTPS. In the code example, you can see that connection to Sauce Labs is over HTTP, while the code examples for other languages are over HTTPS. This issue is documented, along with a proposed fix, in the Selenium issue tracker:


import os

from appium import webdriver

caps = {
        'appiumVersion':    '1.13.0',
        'browserName':      'safari',
        'platformName':     'iOS',
        'deviceName':       'iPhone XS Simulator',
        'platformVersion':  '12.2',
        'name': 'simple-ios'
        # you can set a destination for an app to load on the emulator 
        # 'app': ''

user = os.environ.get('SAUCE_USERNAME', 'my-username')
access_key = os.environ.get('SAUCE_ACCESS_KEY', 'my-key')

sauce_url = "https://{}:{}".format(user,access_key)

driver = webdriver.Remote(sauce_url, desired_capabilities=caps)

# appium application logic here