Home >Backend Development >Python Tutorial >Complete steps to build Python + selenium automation environment
This article mainly introduces you to the relevant information about the construction of Python selenium automation environment. The steps of implementation are introduced in detail step by step through pictures and texts. It has certain reference learning value for everyone's study or work. It needs Friends, let’s take a look together
Preface
This article mainly introduces the relevant content about the construction of Python selenium automation environment and share it. For your reference and study, I won’t say much below, let’s take a look at the detailed introduction
Python selenium googledriver
Xiaobai’s Blood and Tears installation tool, the constant summary and writing experience is understanding The thorough and final road
1. Python installation:
First go to Python’s official website to download the installation package
2. After the download is completed, as shown in the figure below
3. Double-click the exe file to install, as shown in the figure below, and set according to the area in the circle , remember to check the checked box, and then click Customize installation to enter the next step:
4. For the above picture, You can customize the installation path through Browse, or click Install directly to install. Click install to complete the installation.
5. Configure environment variables: Configure the current installation path of your Python.exe program in path, Note: As long as the installation path of this program is required, do not also fill in the name of this file, separate it with a semicolon.
If you want to use pip later, you also need to add the installation path of pip.exe to path. This means that you need to configure it at least twice. It is more convenient to use pip.
6. In order To check whether our python is installed successfully, you can enter python in the command window to query. If the information in the first picture below is displayed, it means success. If the information in the second picture is displayed, it means an error has occurred.
Second, install pycharm
1. First download pycharm from the website: click to open the link (the link is: http://www.jetbrains.com/pycharm/download/). Here I recommend a PyCharm 2017.3 Chinese professional cracked version (with Chinese package cracking method), click here Download and enter as shown below. Select according to your computer's operating system. For Windows systems, select the area circled in red in the picture.
2. After the download is completed, the following figure is shown:
3. Double-click the downloaded exe file to install it. The installation screenshot is as follows:
Click Next to proceed to the next step:
Click Next to proceed to the next step:
Click Install to install:
After the installation is completed, the following interface will appear. Click Finish to complete the installation:
Let’s create our first program:
1. Click the pycharm icon on the desktop to enter pycharm, as shown below Shown:
2. We select the second one and click Ok:
3. Click on the image above Accept in to go to the next step:
4. Click ok in the above picture to enter the next step:
5. Click Create New Project and enter the following picture Interface, the Location in the picture is to select the location of the python you installed. After selecting, click create.
#6. In the interface shown below, right-click where the arrow in the picture points, then select python file and fill in the file name in the pop-up box (any fill in).
#7. After the file is created successfully, you will enter the following interface and you can write your own program. Of course, if you are not satisfied with this interface, you can set the background yourself. I won’t explain it in detail here (just use Baidu yourself).
Note: Requires a cracked version:
Since the latest jetbrains released IntelliJ IDEA 15. PyCharm5.PhpStorm10.WebStorm 11 and other versions, but the registration method has been changed. The original registration code, including the registration machine, can no longer be used.
Now there is a relatively simple registration method. When registering, select "License server" and enter "http://15.idea.lanyus.com/" and click "OK" to quickly activate JetBrains series products
Use the latest update path:
http://idea.lanyus.com
## Second, install the request module and webdriver
Check the Python installation path under F:\Python\Scripts to see if there is pip.exe##Note: pip is an installation management tool. If the pip version is too low, you can use the above command to upgrade pip. If there is no pip, you need to install pip, or install it directly with an external download package. You can use: F:\Python\Scripts>easy_install.exe pip (update pip)
Install selenium:(1) Use cmd In the command window, switch to your Python installation path, under the pip program path of F:\Python\Scripts.
(2) Enter: pipinstall-Uselenium
(3) Check whether selenium is installed and import selenium in the IDE. If no error is reported, it means it is installed
Third, install Google’s driver: Download the Google driver that matches your current version: it must match the current version
If it does not match, it is possible This error occurs:
# Place it under your Google installation path: C:\ProgramFiles (x86)\Google\Chrome\Application
Basically this way That's it.
Configure the path of this driver in the environment variable.
(Environment variables are the search paths that the system automatically calls to start some programs.)
Four: This prompt will appear: Remove this prompt
Install this:
2. Or configure it
and you may report this error:
is a mismatch between the Google driver and the browser
The above is the detailed content of Complete steps to build Python + selenium automation environment. For more information, please follow other related articles on the PHP Chinese website!