selenium简介

Selenium Python bindings 提供了一系列简单的API,让我们使用Selenium WebDriver调用 WebDriver的所有功能,方便得操作像Firefox, IE, Chrome, Remote等等浏览器
[selenuim官网](https://www.seleniumhq.org/docs/index.jsp# "selenuim官网")

selenium安装

pip install selenium

selenium驱动

WebDriver 需要通过浏览器驱动来与浏览器交互。
以下列出几种常用的浏览器驱动下载地址,我建议大家都选择Chrome浏览器来做自动化测试。
[selenuim浏览器驱动官网下载](https://www.selenium.dev/documentation/en/webdriver/driver_requirements/#adding-executables-to-your-path "selenuim浏览器驱动官网下载")
Chrome:
https://sites.google.com/a/chromium.org/chromedriver/downloads
Firefox:
https://github.com/mozilla/geckodriver/releases
Edge:
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver
Safari:
https://webkit.org/blog/6900/webdriver-support-in-safari-10
使用不同的浏览器,需要下载对应驱动,并且确保驱动文件如chromedriver.exe放到你的系统环境PATH中,这里我将它放到python安装目录下。
如:C:\Program Files\Python38\chromedriver.exe

转载至 https://www.kancloud.cn/guanfuchang/python_selenium