Created
May 23, 2017 13:10
-
-
Save wongJonathan/f849bbe098d294da1c141121c4a0533f to your computer and use it in GitHub Desktop.
Selenium script to use SauceLabs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
# This is the only code you need to edit in your existing scripts. | |
# The command_executor tells the test to run on Sauce, while the desired_capabilities | |
# parameter tells us which browsers and OS to spin up. | |
desired_cap = { | |
'platform': "Mac OS X 10.9", | |
'browserName': "chrome", | |
'version': "31", | |
'useSauceLabs': True | |
} | |
driver = webdriver.Remote( | |
command_executor='http://0.0.0.0:8081/proxy', | |
desired_capabilities=desired_cap) | |
# This is your test logic. You can add multiple tests here. | |
driver.get("http://www.google.com") | |
if not "Google" in driver.title: | |
raise Exception("Unable to load google page!") | |
print driver.title | |
# This is where you tell Sauce Labs to stop running tests on your behalf. | |
# It's important so that you aren't billed after your test finishes. | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment