SoFunction
Updated on 2024-12-20

Detailed configuration and problem solving for Python+Selenium+ChromeDriver

Pre-installation preparation

Installation and Configuration

Under Window: Find Run in the start menu and type cmd or directly search for cmd and click enter, type python, if the >>> > in the figure below appears, it proves that Python installation is successful.

在这里插入图片描述

Detecting the version number of Chrome Installing Chromedriver

在这里插入图片描述

Record the version number:87.0.4280.88

Open the ChromeDirver URL:/

Select the folder with the corresponding version number and open it

在这里插入图片描述

Environment Configuration for ChromeDriver

ChromeDriver downloads and unpacks as a

在这里插入图片描述

Place in any folder (we recommend placing it in a folder with the same name as the browser e.g.)

在这里插入图片描述

Configure environment variables (configure them and use the CMD command line to quickly open them):
This PC = "Properties = "Advanced Properties

在这里插入图片描述

New variable, paste the path (of the path)

在这里插入图片描述

After configuration, test with cmd

Type chromedriver, correct as follows

在这里插入图片描述

Installing selenium (python command)

Under Cmd, type: python -m pip install selenium and wait for the installation to complete.

在这里插入图片描述

To update pip, type python -m pip install --upgrade pip
After successful installation, type python -m pip install selenium again, and it will appear as complete.

在这里插入图片描述

Testing, Python Testing Selenium + ChromeDriver

Create a new python file with the following contents

from selenium import webdriver
import time
 
def a():
 b=()
 ('/')
 (3)
 ()
 
if __name__=='__main__':
 a()

will automatically open the Chrome browser, and visit the home page of Baidu, Note: In order to Python crawler speed, at this time, Chrome for the pure version, without any plug-ins, such as plug-ins to help crawl, can be completed in code!

在这里插入图片描述

Some problems during installation

在这里插入图片描述

If any of the above errors occur, check them in order
1, whether the version of ChromeDriver corresponds to the current Chrome version number.
(Chrome kernel updates itself)
environment configuration, cmd input chromedriver no problem can be
3. Close the IDE (the current python compiler) and restart it

To this point this article on Python + Selenium + ChromeDriver configuration and problem solving article is introduced to this, more related Selenium ChromeDriver configuration content please search for my previous articles or continue to browse the following related articles I hope that you will support me in the future more!