Skip to content

Instantly share code, notes, and snippets.

@jsmoxon
Created September 12, 2012 23:37
Show Gist options
  • Save jsmoxon/3710788 to your computer and use it in GitHub Desktop.
Save jsmoxon/3710788 to your computer and use it in GitHub Desktop.
Test Method
...
self.driver.implicitly_wait(30)
def test_sauce(self):
self.driver.get('http://saucelabs.com/test/guinea-pig')
self.assertTrue("I am a page title - Sauce Labs" in self.driver.title);
self.driver.find_element_by_id('comments').send_keys('Hello! I am some example comments. I should appear in the page after you submit the form')
self.driver.find_element_by_id('submit').click()
comments = self.driver.find_element_by_id('your_comments')
self.assertTrue('Your comments: Hello! I am some example comments. I should appear in the page after you submit the form' in comments.text)
body = self.driver.find_element_by_xpath('//body')
self.assertFalse('I am some other page content' in body.text)
self.driver.find_elements_by_link_text('i am a link')[0].click()
body = self.driver.find_element_by_xpath('//body')
self.assertTrue('I am some other page content' in body.text)
def tearDown(self):
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment