美文网首页
UI自动化-01-搭建环境-极简

UI自动化-01-搭建环境-极简

作者: 果芽软件 | 来源:发表于2019-08-04 15:20 被阅读0次

一、搭建基础环境

1. 新建python工程

image.png

设置pytest执行测试用例


image.png

2. 安装依赖包

pip install selenium

3. 下载浏览器驱动

  1. 下载地址:http://chromedriver.storage.googleapis.com/index.html

  2. 存放目录


    image.png

二、打开浏览器

注意:是大写的Chrome类,而不是小写的chrome属性

import time
from selenium import webdriver

def test_open():
    # 通过驱动程序启动chrome浏览器
    driver = webdriver.Chrome('D:/softwaredate/pythondate/ui-test-04/chrome_driver/chromedriver.exe')
    # 浏览器最大化
    driver.maximize_window()
    time.sleep(2)

执行test_open方法,若能打开浏览器,则说明环境搭建成功

相关文章

网友评论

      本文标题:UI自动化-01-搭建环境-极简

      本文链接:https://www.haomeiwen.com/subject/eaiedctx.html