web automation environment to build (python + selenium + webdriver)

In this document, Google browser, for example, so the automated test environment for the next:

  Automated tools for: selenium + webdriver

  Scripting language: Python3.X

  Browser: Chrome

  System environment: Win10

  Compilation Tools: Pycharm

Specific structures following steps:

  First, install Python

  Download Python3.6.5

  https://www.python.org/downloads/windows/

  

   After the download is complete, double-click to open

  

  Click the Run button

  

  Installation interface, check Add Python3.6 to PATH, select Customize installation

  

  Click next to the next step

  

  Check Install for all users, will automatically check Precompile standard library, the installation path is preferably below the default path, but also to change the path you want to install:

  

  Click install to start the installation:

  

  After installation is complete, click Close to close the installation page, open the Run - cmd-- input into the command window, enter Python check whether the installation was successful.

  (I have installed on your computer is version 3.6.2)

  

  Second, download and install the integrated development tools Pycharm

  

  Double-click to open the install, click Next

  

   The default installation path may be the path you choose to install, select the installation path, click Next:

  

   Select the IDE version to install (here selected 64 individuals selected according to necessity), check the Create Associations (create an association .py files) and

     Download and install JRE x86 by JetBrains (operating environment), click Next:

   

  The default installation folder can also create a new one, click Install to install:

  

  Installation is complete, click Finish:

  

  

  Double-click the desktop to open PyCharm development tools (optional for the first time open their own favorite theme, click Next):

      

      Plug-in download page, you can skip, click Start using PyCharm (see personal needs):

      

      选择Create New Project,新建一个项目名为TestWeb,并点击Create:

     

     

     直接关闭当前页面,也可把左下角的勾去掉,然后关闭窗口:

     

    右键点击项目名TestWeb -> New –>Python Package,新建一个包:

     

     自己命名包名 TestWebPackage,点击OK:

     

     右键点击包名TestWebPackage –> New ->Python File,创建一个Python文件:

     

     文件名称可自己命名 TestWebFile,点击OK:

     

    注:第一次打开可能会提示你需要进行破解

    破解方法:打开Pycharm---调整电脑系统时间为2099年---关闭重新打开Pycharm---选择试用30天即可。

  三、安装selenium类库(File--Setting):

  

  选择Project Interpreter,点击右侧的+号:

  

   搜索selenium,够选Specify version,可选择selenium版本(可使用最新版本3.11.0),然后点击install package进行安装:

  

  下面显示Package‘selenium’installed successfully,安装成功:  

  

  同样在File –> Settings -> Project Interpreter中查看selenium版本:

  

  四:安装Chrome

  本人安装的是75.0版本,安装步骤省略。。。

  

  下载Chrome浏览器版本对应的chromedriver,如下图:选择75版本

  Chromedriver下载地址:http://npm.taobao.org/mirrors/chromedriver/

  

  点击进入下载页面, 选择对应的环境版本Chromedriver_win32.zip,进行下载

  

  下载完后解压并打开,把里面的chromedriver.exe文件放到Python目录下Scripts文件夹下(根据自己的Python安装目录而定):

  

  OK 开发环境就搭建好了!

  

 

  

  

 

  

  

      

 

Guess you like

Origin www.cnblogs.com/wulixia/p/11200023.html