First, Login
1. Open the browser first
2. Open Forum Home:http://www.hordehome.com/
3. you can set the element wait before finding the element:implicitly_wait ()
4. Click the login button to pop up the login box
5. Enter the user name, password, and then click Login
Second, the inspection results
1. after the login is completed, you need to check whether the login is successful, here you need to have a checkpoint, the small part of the selection is to view the login profile picture Properties
2. Navigate to the login avatar and get to the title property of the object via the Get_attribute () method
3. determine whether the obtained value is consistent with the expected result
4. test pass with expected results
5. test does not meet the expected results
Third, sign out
1. after the test, don't forget to log out at the end
2. After exiting the login, close the browser
Four, login function
1. Although the code above can be logged in, the entire code is no more readable than the journal. If I want to change account login, this time also have to find the login account and password location, relatively time-consuming.
2. we can write two functions for login and exit, so it looks more comfortable.
3. parameterize the login account and password
V. Running Use Cases
1. Call the login function first
2. Check the login results
3. log out and close the browser
Selenium+python Automation Login Case