selenium Introduction and Installation

selenium Introduction

Initially selenium is an automated testing tool, and reptiles use it mainly to solve the problem requests can not be directly executed JavaScript code

selenium is essentially driven by the browser, fully simulate the operation of the browser, such as jumps, input, click the drop-down, etc., to get the results after page rendering to support multiple browsers

installation

pip3 install selenium

Ready to work

1, download the Chrome browser

2, then install ChromeDriver. Because only install ChromeDriver, to drive its Chrome browser, complete the appropriate action. Here we introduce how to install under ChromeDriver.

View version

Click the Chrome menu "Help" → "About Google Chrome", you can see the version number of Chrome

Google browser version corresponding to the drive to keep Google

Download Google Chrome drive: http://npm.taobao.org/mirrors/chromedriver/

3, environment variable configuration

After the download is complete, the configuration ChromeDriver executable file to the environment variable.

Under Windows, the proposal directly drag chromedriver.exe file of Python Scripts directory

Or in the code at the specified actuated position (relative path / absolute path)

browser = webdriver.Chrome(executable_path='./chromedriver')

 

Guess you like

Origin www.cnblogs.com/baohanblog/p/12669086.html