Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
47 lines (37 sloc) 1.58 KB
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at
from unittestzero import Assert
from import WebDriverWait
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import ElementNotVisibleException
class Page(object):
def __init__(self, testsetup):
self.testsetup = testsetup
self.selenium = testsetup.selenium
self.base_url = testsetup.base_url
self.timeout = testsetup.timeout
def is_the_current_page(self):
if self._page_title:
WebDriverWait(self.selenium, 10).until(lambda s: self.selenium.title,
'A page title did not appear before the timeout')
Assert.equal(self.selenium.title, self._page_title)
return True
def is_element_visible(self, *locator):
return self.selenium.find_element(*locator).is_displayed()
except NoSuchElementException, ElementNotVisibleException:
return False
def is_element_present(self, *locator):
return True
except NoSuchElementException:
return False
# set back to where you once belonged
Jump to Line
Something went wrong with that request. Please try again.