Selenium+python配置环境
1.下载Python库:Anaconda
2.将python环境改为Anaconda
谷歌下载驱动地址:http://chromedriver.storage.googleapis.com/index.html
3.下载谷歌驱动放到Anaconda里 驱动要和谷歌版本一致 下载win32 解压放到Anaconda
4.在Python里面下载:pip install selenuim
5.然后在python里面输入
from selenium import webdriver
driver = webdriver.Chrome()
driver.get(‘https://www.baidu.com’)
如果能访问到百度就成功了
如果报找不着位置:
python输入:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.binary_location =r’F:\各种包\Google\Chrome\Application\chrome.exe’
browser = webdriver.Chrome(options=options)
browser.get(‘https://www.baidu.com’)
F:\各种包\Google\Chrome\Application\chrome.exe:是谷歌浏览器存放的位置