[suitable for non python novices] selenium automated test 1- environment installation

catalogue

background

python environment

pip configuration

Configuration method 1: permanent configuration (Douban image source)

Configuration method 2: temporarily effective (Douban image source)

selenium installation

pycharm installation

background

The concept of automated testing actually appeared many years ago. However, I haven't had time for systematic learning and summary. I call this learning opportunity to share the automatic test based on Python selenium from 0 to 1.

Note: the series of tutorials is only suitable for students with python skills, otherwise part of the content may be unfamiliar

python environment

However, the first lesson is the installation environment, and so is selenium learning. Selenium is a python dependent running environment. When I typed this article, python had been updated to version 3.8.

python official website

Go directly to the official website to download the latest version. Here is a tip:

If you are a window user, the official will provide multiple download links:

Download Windows x86 web-based installer
Download Windows x86 executable installer
Download Windows x86 embeddable zip file
Download Windows x86-64 web-based installer
Download Windows x86-64 executable installer
Download Windows x86-64 embeddable zip file
Download Windows help file

Many students are directly covered in circles.

Explain the difference a little:

x86 Only 32-bit systems are supported; 
x86-64 Support 64 bit systems. 
web-based Networking is required during installation;
executable Executable file(.exe)Installation mode;
embeddable zip file Embedded version, which can be integrated into other applications.

Usually select executable to download and install. Note:

Note: during installation, check:“ Add Python 3.x to PATH" , If it is not checked, it needs to be checked after the installation is completed Python Installation directory (e.g.: C:\Python36)Add to environment variable PATH below.

After the installation is successful, open a cmd window, enter python, and enter the repl environment. The following indicates that the installation is successful:

C:\Users\name>python
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

pip configuration

pip is the most commonly used tool in python. pip is used when installing third-party packages or dependencies.

Ensure that the pip command can be used, as shown below:

First, in Windows Command prompt( cmd)/ Linux Terminal input:
C:\Users\name>pip
 
Usage:
  pip <command> [options]
 
Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
......

Ensure that the PIP command is available. If you are prompted that "pip is not an internal or external command", you need to add the installation directory of PIP (e.g. C: \ Python 36 \ scripts) to the environment variable PATH.

The default image source of pip is very slow to download. Therefore, it is necessary to configure the default image source of pip. At present, Douban image source and Tsinghua image source are relatively fast.

Configuration method 1: permanent configuration (Douban image source)

After configuration, the configuration of the mirror source will take effect permanently.

Run the following script directly in cmd:

import os;  ini = "[global]\nindex-url = https://pypi.doubanio.com/simple/\n[install]\ntrusted-host = http://pypi.douban.com" ; pippath=os.environ["USERPROFILE"]+"\\pip\\" ; exec("if not os.path.exists(pippath):\n\tos.mkdir(pippath)"); open(pippath+"/pip.ini","w+").write(ini);

Or in C: / user / Adminitrator / appdata / PIP / pip Ini, the PIP folder in this path may not exist, so you need to create it manually Ini needs to be created manually. Then enter:

[global]

index-url = http://pypi.douban.com/simple
[install]
trusted-host = http://pypi.douban.com

Configuration method 2: temporarily effective (Douban image source)

It is only used once. When installing, specify the index URL.

pip install --index-url https://pypi.douban.com/simple package name

selenium installation

Finally, because you depend on selenium, you need to install selenium

pip install selenium

pycharm installation

Choose pycharm as the idea tool. Go directly to the official website and download the community version because it is free.

Added by srsimmons on Fri, 14 Jan 2022 06:06:43 +0200