浏览器安装驱动
个人习惯使用Chrome:
Chrome浏览器驱动:http://chromedriver.storage.googleapis.com/index.html
https://sites.google.com/a/chromium.org/chromedriver/home
根据版本号这几个都能用
import sys
print(sys.executable)
Firefox浏览器驱动:https://github.com/mozilla/geckodriver/releases/
IE浏览器驱动:http://selenium-release.storage.googleapis.com/index.html
Edge浏览器驱动:
(EdgeHTML):https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
(Chromium)https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Opera浏览器驱动:https://github.com/operasoftware/operachromiumdriver/releases
**Safari浏览器驱动:**直接代码
from selenium import webdriver
# 启动浏览器
driver = webdriver.Safari()
二、安装selenium
Selenium下载安装
Selenium 安装非常简单,Linux、Mac 用户执行以下命令即可:
sudo pip install Selenium
Windows 用户执行以下命令即可实现安装:
python -m pip install selenium
除了使用上述命令安装外,也可以通过官方网站下载 Selenium WebDriver 安装包
出现报错WARNING: You are using pip version 22.0.4; however, version 22.2.2 is available.
You should consider upgrading via the ‘D:\Python\python.exe -m pip install --upgrade pip’ command.
解决方法:
执行后,使用 pip show selenium 查看是否安装成功
2.尝试跑动
总结
seleuim3.0版本一些使用方法都改变了,有些方法也包含到service中,学习的过程中着实是有点麻烦了哎。