Tell me how you can register a simple search of incorrect logins / passwords to perform negative test cases in the list.
There is a certain list that contains usernames / passwords with invalid characters that we will check:
list = ["log in", "lögin", "login%"]etc. You can, of course, import from a file, but the list is simpler.
We have the Login field, where we will first insert the first value from the list:
driver.find_element_by_id("Login").send_keys(list[0])Press the OK button:
driver.find_element_by_id("OK_button").click()After that, the expected result is that the form will display a message:
"The Login field has invalid format."- i.e. everything goes according to plan and we are not allowed to create an account with invalid characters.I understand that to draw up a condition, you can push away from this message appearing on the page:
driver.find_element_by_link_text("The Login field has invalid format.")
After that we have to erase the login in the Login field and substitute the next in the list:
driver.find_element_by_id("Login").clear() driver.find_element_by_id("Login").send_keys(list[1]) driver.find_element_by_id("OK_button").click() Tell me, please, how to do this process with fewer lines of code.
Writing three lines for each value from the list is not a very productive solution, especially if there can be up to a hundred elements in the list.