一、打开终端
输入 pip install selenium
二、安装浏览器driver
火狐:https://github.com/mozilla/geckodriver/releases/
谷歌:http://chromedriver.storage.googleapis.com/index.html
三、测试是否安装成功
打开python 自带IDEA或者pytharm
输入
# 启动谷歌浏览器
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('http://www.baidu.com')
driver.find_element_by_id('kw').send_keys('selenium')
--------------------------或者--------------------------------------
# 启动火狐浏览器
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('http://www.baidu.com')
driver.find_element_by_id('kw').send_keys('selenium')