Python + Selenium UI Automation --Day1

In fact, been studying automation, because of their own working time is not too much, but quiet study, while watching forgotten, so I decided to learn every day recorded knowledge, but also a consolidation of knowledge. Prior to the interface to find out about relevant knowledge of automation, the goal of learning is to master the interface automation, after all, most companies hiring automation testers this time are valued interfaces, and the interface with respect to the UI is a little more complicated, so UI automation to start to learn, slowly and surely, believe in yourself!

DAY1-- built environment

Reference: https: //www.cnblogs.com/zidonghua/p/7429099.html#_labelTop

------------------------------- ----------------- environmental information --------------

 Python 3.7.3 + Selenium 2 + Firefox 45

-------------------------------------------------------------------------------------

A, Python 3.7.3 installation and configuration

1. Download Python 3.7.3

Download the official website address: https: //www.python.org

Select the corresponding python version, system, download to a local

 2. Double-click the installation, check the "Add Python 3.7 to PATH" option, which will automatically configure the environment variables

 All the way back default Next, the installation is complete

 3. Verify that the installation was successful

Win + R cmd run into the command line, enter the command Python, if a successful installation is shown below

 

Two, Selenium installation and configuration 2

1. Install Selenium 2.53.6

Win + R cmd run into the command line, pip install selenium == 2.53.6 mounting selenium 2.53.6

Execute the command will download selenium package, so it is necessary to wait for some time, error-free installation is complete

tips: 在使用pip install命令安装时,可能会出现如下提示,出现该提示是因为pip的版本太低建议升级,按照提示:python -m pip install --upgrade pip 升级即可。

 2. 验证是否安装成功

如何验证selenium有没有安装成功呢?写代码打开浏览器试试

笔者用的浏览器是Firefox 45,下载地址:https://download-installer.cdn.mozilla.net/pub/firefox/releases/

cmd中运行如下代码:

若Firefox能正确打开并跳转到百度首页,那么selenium就可以正常使用了

tips: 笔者用的Firefox 45不需要浏览器驱动,Firefox 46以上版本就需要驱动了;若使用Chrome或IE,也需要另外下载对应版本的浏览器驱动到python根目录(与python.exe同目录)

Chrome浏览器的chromedriver版本驱动大全,下载地址:http://chromedriver.storage.googleapis.com/index.html

IE浏览器的IEdriver版本驱动大全,下载地址:http://selenium-release.storage.googleapis.com/index.html

查找python安装目录:cmd下输入 where python

 

三、安装Pycharm

下载地址:http://www.jetbrains.com/pycharm/

Guess you like

Origin www.cnblogs.com/xuzhangmin/p/11839333.html