Created
June 25, 2011 11:13
-
-
Save baijum/1046377 to your computer and use it in GitHub Desktop.
Selenium TestCase using Python binding
This file contains 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
import unittest | |
import time | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
class PythonOrgSearch(unittest.TestCase): | |
def setUp(self): | |
self.browser = webdriver.Firefox() | |
def test_search_in_python_org(self): | |
browser = self.browser | |
browser.get("http://www.python.org") | |
assert "Python" in browser.title | |
time.sleep(2) | |
elem = browser.find_element_by_name("q") | |
elem.send_keys("selenium") | |
elem.send_keys(Keys.RETURN) | |
assert "Google" in browser.title | |
def tearDown(self): | |
self.browser.close() | |
if __name__ == "__main__": | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment