####
Create a new Python virtual environment and install selenium
Create a new Python project,
####
from selenium import webdriver driver = webdriver.Chrome() driver.get("https://www.baidu.com")
###
report errors:
‘chromedriver’ executable needs to be in PAT
###
What should I do?
Download chromedriver
Step 1: check your browser version and enter the URL: chrome://version/
Step 2: download the corresponding version of chromedrive at: http://chromedriver.storage.googleapis.com/index.html
Step 3: put the package under the project directory,
Step 4: modify the code and add the file path of drive,
Here is the code:
###
from selenium import webdriver driver = webdriver.Chrome(executable_path="./chromedriver") driver.get("https://www.baidu.com")
###
Then you can play happily. As long as you master the positioning and various operation APIs, you can basically get started and do your own projects,
###
####