vendredi 27 février 2015

selenium python check hide error

So, i need to create some test for check login/registration. I trying to catch hide error when user enter email incorrect. Steps: 1. Enter not valid email. 2. Press button "Login". 3. Should show error what "password or email is not correct".


Below i wrote 2 function. How i can combine this two function? Second function always show me "OK" status.



def test_login_user(self):
driver = self.driver
driver.get("http://ift.tt/1ybKKlM")
driver.find_element_by_name('email').send_keys("email24")
driver.find_element_by_name('password').send_keys('12345678')
driver.find_element_by_name('signin').click()

def test_error(self):
driver = self.driver
driver.get('http://ift.tt/1ybKKlM')
error = driver.find_element_by_css_selector('div.status.submission-error')
if error.is_displayed():
return True
else:
return False

Aucun commentaire:

Enregistrer un commentaire