标签:-- 生成 cal inpu selector key driver play install
安装pytest
dos命令直接输入:pip install pytest
检查是否安装成功:
dos命令输入:where pytest
-----------------------------------------
将测试结果生成测试报告
安装测试报告插件:pip install pytest-html
---------------------------------------------------------------------------------------------------------------------------
pytest case.py -html=report.html 生成html模式的测试报告
-----------------------------------------------------------------------------------------------------------------------------
利用pytest+selenium做webUI测试
# var=input(‘请输入helloworld‘)
# assert ‘hello‘ in var
# print(‘测试通过‘)
#测试添加课程webUI
def test_addCourse():
from selenium import webdriver
driver=webdriver.Chrome()
driver.implicitly_wait(10)
driver.get(‘http://localhost/cm039/index.html#/‘)
driver.find_element_by_css_selector(‘[ng-click="showAddOne=true"]‘).click()
#输入课程名称
driver.find_element_by_css_selector(‘[ng-model="addData.name"]‘).send_keys(‘selenium‘)
#输入课程描述
driver.find_element_by_css_selector(‘[ng-model="addData.desc"]‘).send_keys(‘seleniumdesc‘)
#输入展示次序
driver.find_element_by_css_selector(‘[ng-model="addData.display_idx"]‘).send_keys(‘2‘)
#点击确定
driver.find_element_by_css_selector(‘[ng-click="addOne()"]‘).click()
driver.quit()
------------------------------------------------------------------------------------------------------------------
标签:-- 生成 cal inpu selector key driver play install
原文地址:https://www.cnblogs.com/cm039/p/12096452.html