Skip to content

Instantly share code, notes, and snippets.

@sauceaaron
Last active October 16, 2018 20:12
Show Gist options
  • Save sauceaaron/422a74c7de70dafb1498f121a7fc07f2 to your computer and use it in GitHub Desktop.
Save sauceaaron/422a74c7de70dafb1498f121a7fc07f2 to your computer and use it in GitHub Desktop.
Simple Python test using Selenium with Sauce Labs
import os
from selenium import webdriver
sauce_url = 'https://ondemand.saucelabs.com/wd/hub'
desired_capabilities = {
'name': 'simple python test',
'username': os.environ['SAUCE_USERNAME'],
'accessKey': os.environ['SAUCE_ACCESS_KEY'],
'platform': 'Windows 10',
'browserName': 'chrome',
'version': 'latest'
}
driver = webdriver.Remote(command_executor=sauce_url, desired_capabilities=desired_capabilities)
driver.get('https://saucelabs.com')
print(driver.title)
assert 'Sauce Labs' in driver.title
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment