Automated test python + selenium = Web UI Automation test

Source: Internet
Author: User

1.1Python Operating Environment

When I decided to learn a new language Python, Python3 has come out, is currently Python2 and Python3 synchronous maintenance, Python2 has a large number of class library, but with the development of time, Python3 is the mainstream of future development, So the version I chose here is Python3.
To install Python:
Python official website: https://www. python.org/ENTER after the selection of the corresponding version to download, Python download is very simple, the next fool-type operation on it, but one thing to note is that when entering this interface () need to check the add Python to 3.xx PATH installation can be:

After installation, turn on the computer terminal cmd-enter Python-the page displays Python's version information to indicate that Python has been installed successfully

1.2Selenium Environment Construction

Selenium Features: open source, multi-lingual, multi-browser, easy to use (this is why I started to choose selenium)

Installation steps for Selenium:
1. windows open terminal, CD + directory instructions into the Python installation directory under the Scripts folder
2. Input directive:Pip.exe Install selenium If the progress bar is shown to 100%, it is already installed (if the abnormal cause is exited and you know the progress is up to 100%)
3. Selenium can support a lot of browsers, but to install the corresponding browser driver , such as My computer's browser is v56, the corresponding download chromedriver version v2.29
(Chrome is used in the notes, and other browsers are similar, so you can check it yourself)

1.3 What is Webdriver?

The official website describes it this way:Webdriver is a clean, fast framework for automated testing of WebApps.
You can find the corresponding version of the browser by using the following connection: (the browser I chose here is chrome)

Http://chromedriver.storage.googleapis.com/index.html
After the download will get an installation package, the installation package decompression, the next important step is: The extracted file path is copied, added to the path: Computer-Properties-Advanced system configuration-environment variables , paste the good path to copy into, remember to add a semicolon before pasting, Separate the other paths and click OK to configure the chromewebdriver.


1.4 Implementation of the first automation script
Now that all the environment variables are configured, let's implement our first automation script right away:

Here, a simple access to Baidu and search for a test case is achieved through automated means, hurry up!

I'm a bean, and I just started blogging. Inevitably there is a bad place to write, but also please give us a lot of advice!

Automated test python + selenium = Web UI Automation test

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.