Selenium+python Automation Login Case

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.