Selenium with Python 001

Selenium Python bindings 提供了一个简单的API,让你使用Selenium WebDriver来编写功能/校验测试。 通过Selenium Python的API,你可以非常直观的使用Selenium WebDriver的所有功能。

Selenium Python bindings 使用非常简洁方便的API让你去使用像Firefox, IE, Chrome, Remote等等 这样的Selenium WebDrivers(Selenium web驱动器)。当前支持的版本为 2.7, 3.2及以上。

一、安装python selenium binding

pip install selenium

二、安装浏览器驱动

Chrome:https://sites.google.com/a/chromium.org/chromedriver/downloads

Edge:https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

Firefox:https://github.com/mozilla/geckodriver/releases

Safari:https://webkit.org/blog/6900/webdriver-support-in-safari-10/

使用不同的浏览器,需要下载对应驱动,并且确保驱动可执行文件,如chromedriver.exe放到你的系统环境PATH中,这里我将它放到python安装目录下。D:360YPVMPython35Scriptchromedriver.exe

三、下载Selenium Server

注意:The Selenium server is only required if you want to use the remote WebDriver

Selenium Server 是个java 程序,推荐使用JRE 1.6以上的java环境运行。我们可以从download page of selenium website 中下载 Selenium Standalone Server,名字类似 selenium-server-standalone-3.5.0.jar,启动方式如

java -jar selenium-server-standalone-3.5.0.jar

使用详情,请查看后面章节介绍。


***微信扫一扫,关注“python测试开发圈”,了解更多测试教程!***
原文地址:https://www.cnblogs.com/guanfuchang/p/6497840.html