[python] Install browser driver

To use the Selenium module, a browser driver needs to be installed. The drivers of different browsers are different. Taking Chrome as an example, the driver of Chrome is ChromeDriver.

Open the browser, open the settings

Check "About Chrome", check your browser version, remember your browser version,

Then open http://chromedriver.storage.googleapis.com/index.html and find the link closest to the corresponding version

Download the file corresponding to the system version, decompress it, and put it in the Scripts folder under the python installation directory

(How to view the installation directory: win+R to open the "Run" dialog box, enter "cmd", press Enter, "where python", press Enter)

Open a web page using the browser driver

from selenium import webdriver
import time
import random

driver=webdriver.Chrome()
driver.get('http://www.baidu.com')


time.sleep(random.uniform(20,50))

driver.quit()

 

Guess you like

Origin blog.csdn.net/weixin_39407597/article/details/126651939