转载https://blog.youkuaiyun.com/azsx02/article/details/68947429
安装三大浏览器驱动driver
1.chromedriver 下载地址:https://code.google.com/p/chromedriver/downloads/list
2.Firefox的驱动geckodriver 下载地址:https://github.com/mozilla/geckodriver/releases/
3.IE的驱动IEdriver 下载地址:http://www.nuget.org/packages/Selenium.WebDriver.IEDriver/
注意:下载解压后,将chromedriver.exe , geckodriver.exe , Iedriver.exe发到Python的安装目录,例如 D:\python 。 然后再将Python的安装目录添加到系统环境变量的Path下面。
然后打开Python IDLE分别输入以下代码来启动不同的浏览器
启动谷歌浏览器
from selenium import webdriver browser = webdriver.Chrome() browser.get('http://www.baidu.com/') 启动火狐浏览器
from selenium import webdriver browser = webdriver.Firefox() browser.get('http://www.baidu.com/')
启动IE浏览器
from selenium import webdriver browser = webdriver.Ie() browser.get('http://www.baidu.com/')
本文介绍了如何安装和配置Chrome、Firefox及IE三种浏览器的WebDriver驱动程序,并提供了具体的下载链接及设置步骤。通过这些步骤,可以轻松地使用Python的Selenium库进行浏览器自动化操作。
1290

被折叠的 条评论
为什么被折叠?



