Skip to content

Instantly share code, notes, and snippets.

@bjelline
Created May 16, 2015 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjelline/70d18b20f2ac7aee3f4b to your computer and use it in GitHub Desktop.
Save bjelline/70d18b20f2ac7aee3f4b to your computer and use it in GitHub Desktop.
simplest selenium test with python and chrome
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
driver.get("http://localhost:5000/mood")
assert "Test App" in driver.title
el = driver.find_element_by_id('save')
el.click()
body = driver.find_element_by_xpath('//body')
assert 'saved to the database' in body.text
driver.close()
print "done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment