Disclaimer: The technical means and implementation process recorded in this paper are only used as the learning and use of crawler technology, and we do not assume any responsibility for any thing or consequences caused by any act or omission of any person based on all or part of the contents of this paper.

Selenium is a tool for automated testing of Web systems that simulates browser parsing of dynamically generated sites. The overall installation process is as follows:

01 Install Chrome

Visit chrome’s official website to download and install chrome.

02 install Selenium

Open the command line and enter the command to install Selenium: PIP Install Selenium

Selenium installed successfully!

03 download ChromeDriver

Open the ChromeDriver download address, select the corresponding Chrome version download save, and remember path: chromedriver.chromium.org/downloads

Such as: ‪ C: \ chromedriver exe ‬

04 Running Example

Write test code to open Baidu website as an example:

Run code:

The code runs successfully, can normally open Baidu page, but there is a prompt message, Chrome is under the control of automatic test software, and did not maximize the open window, increase the relevant Settings code.

options = Options();

Remove the automatic control prompt

options.add_experimental_option(“excludeSwitches”, [‘enable-automation’]);

Maximize window running

browser.maximize_window()

Run the code, the problem is solved, the environment is set up successfully!

All sample codes can be downloaded through wechat official account reply keyword [pachong23]!