1

I am checking two validations by sending keys in file test1.py

        # Check email is valid
        find_account.enter_email('amit@')
        find_account.click_search_button()
        validation_invalid_email = find_account.get_validation_invalid_email()
        self.assertEqual('Email should be valid.', validation_invalid_email, 'Invalid email validation is missing')
        time.sleep(2)

        # Check email id exists in database
        find_account.enter_email('No_user_exists@some.com')
        find_account.click_search_button()
        time.sleep(2)
        error_message_prompt = find_account.get_error_message_prompt()
        self.assertEqual('User not found!', error_message_prompt, 'Error message is missing')
        time.sleep(3)

which takes reference from file testpage.py for entering values in email field

    def enter_email(self, email):
        self.driver.find_element_by_id(self.email_field_id).click()
        self.driver.find_element_by_id(self.email_field_id).clear()
        self.driver.find_element_by_id(self.email_field_id).send_keys(email)

But clear() does not works. Instead appends value to previous one in textbox field & hence test is failing. I was trying with clear() only but that does not worked. Then I tried with click() then clear(), but this also not worked.

Charu Jain
  • 29
  • 2

0 Answers0