Skip to content

Instantly share code, notes, and snippets.

@mdsauce
Created November 6, 2018 19:28
Show Gist options
  • Save mdsauce/f6dd612a495fe96237ed9fbca96ebf73 to your computer and use it in GitHub Desktop.
Save mdsauce/f6dd612a495fe96237ed9fbca96ebf73 to your computer and use it in GitHub Desktop.
basic-build-test.py
from selenium import webdriver
from sauceclient import SauceClient
from random import randint
import os
username = os.environ.get('SAUCE_USERNAME')
access_key = os.environ.get('SAUCE_ACCESS_KEY')
sauce_client = SauceClient(username, access_key)
buildNum = randint(1,1000)
desired_caps = {
'platform': "Windows 10",
'browserName': "firefox",
'version': "latest",
'name': "My basic Python test",
'build':"My-hyphenated-test-%s" % buildNum
}
driver = webdriver.Remote(command_executor="http://%s:%[email protected]/wd/hub" % (username, access_key), desired_capabilities=desired_caps)
driver.maximize_window()
driver.execute_script("sauce:context=Now moving to Google")
driver.get("https://www.google.com")
sauce_client.jobs.update_job(driver.session_id, passed=True)
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment