Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple test using the PageElements
from selenium.webdriver.support.ui import WebDriverWait
import pages
def test_login_with_invalid_credentials(login_url):
try:
driver = get_browser()
driver.get(login_url)
login_page = pages.LoginPage(driver)
# Can't use this method here since we want to actually test the various aspects of
# logging in and failing to log in
# login_page.login() - Use this in other tests where you just need to login to do the
# test
login_page.username = XXXXXXXX
login_page.password = XXXXXXXX
login_page.click_login_button()
assert(login_page.error_message.text == 'Invalid email or password. Please try again.')
assert(driver.current_url == login_url)
finally:
logger.info('Quitting browser')
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment