Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 30 lines (23 sloc) 0.902 kb
b38dc72e » davehunt
2011-07-19 Created tests for logging in and logging out.
1 #!/usr/bin/env python
9d83222a » Zac
2012-01-27 MPL2 licence migration
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
b38dc72e » davehunt
2011-07-19 Created tests for logging in and logging out.
5
757232b7 » Zac
2011-12-05 Wait for page title to be present.
6 from selenium.webdriver.support.ui import WebDriverWait
c46449b0 » davehunt
2011-12-06 Reordered imports, and removed superfluous assertion message.
7 from unittestzero import Assert
b38dc72e » davehunt
2011-07-19 Created tests for logging in and logging out.
8
dd803884 » davehunt
2012-03-03 PEP8 fixes.
9
b38dc72e » davehunt
2011-07-19 Created tests for logging in and logging out.
10 class Page(object):
11
12 def __init__(self, testsetup):
13 self.testsetup = testsetup
14 self.base_url = testsetup.base_url
15 self.selenium = testsetup.selenium
16
17 @property
18 def is_the_current_page(self):
757232b7 » Zac
2011-12-05 Wait for page title to be present.
19 if self._page_title:
20 WebDriverWait(self.selenium, 10).until(lambda s: self.selenium.title)
21
c46449b0 » davehunt
2011-12-06 Reordered imports, and removed superfluous assertion message.
22 Assert.equal(self.selenium.title, self._page_title)
757232b7 » Zac
2011-12-05 Wait for page title to be present.
23 return True
b38dc72e » davehunt
2011-07-19 Created tests for logging in and logging out.
24
25 def is_element_visible(self, locator):
26 try:
27 self.selenium.find_element(*locator)
28 return True
29 except:
30 return False
Something went wrong with that request. Please try again.