mac 搭建python+selenium+chromedriver环境
Python 3.7.6
1.安装selenium
pip install selenium
2.根据自己的chrome版本下载相应版本的chromedriver
http://npm.taobao.org/mirrors/chromedriver/
3.把chromedriver解压后拷贝到PATH
cp ~/Downloads/chromedriver /usr/local/bin
4.openbaidu.py
#!usr/bin/python from selenium import webdriver import time browser = webdriver.Chrome() browser.get("http://www.baidu.com") browser.find_element_by_id("kw").send_keys("selenium") browser.find_element_by_id("su").click() time.sleep(5) browser.quit()
5.
python openbaidu.py