Skip to content

Instantly share code, notes, and snippets.

@mboersma
Created March 6, 2012 16:44
Show Gist options
  • Save mboersma/1987394 to your computer and use it in GitHub Desktop.
Save mboersma/1987394 to your computer and use it in GitHub Desktop.
Selenium webdriver demo script
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
driver = webdriver.Chrome()
# Log in to OpDemand
driver.get('http://c2-local.opdemand.com:8000/login')
assert driver.title == u'OpDemand / Login'
username_input = driver.find_element_by_class_name('username')
password_input = driver.find_element_by_class_name('password')
submit_button = driver.find_element_by_class_name('alt3')
username, password = 'mboersma', 'password'
username_input.send_keys(username)
password_input.send_keys(password)
submit_button.submit()
# Wait until the page has refreshed and the title updated
WebDriverWait(driver, 10).until(
lambda driver : 'Login' not in driver.title)
assert driver.title == u'OpDemand / Platforms'
## rename your environment
#edit_icon = driver.find_element_by_class_name('edit-icon')
#edit_icon.click()
# go to the templates page
templates_link = driver.find_element_by_link_text('Browse Template Library')
templates_link.click()
# import a template
# change some config values
# start the platform
# change some config values
# deploy to the platform
# stop the platform
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment