selenium installation

Installation selenium module

pip install selenium

Download Browser drive (for example with chrome)

View chrome version

Access http://chromedriver.storage.googleapis.com/index.html, into the same version of the chrome path (denoted by the red line), and then download the driver package (windows in Example)

Decompression chromedriver_win32.zip get chromedriver.exe

Simple example

# coding=utf-8
from selenium import webdriver

path = r "C: \ Users \ Administrator \ Downloads \ chromedriver.exe" #chrome driving path
url = "https://www.baidu.com"
browser = webdriver.Chrome (path) # create a browser object, open chrome
browser.get (url) # open a web page

 Results of the:

 

Guess you like

Origin www.cnblogs.com/vaon/p/11708547.html