摘要: #!/usr/bin/python3 # -*- coding: utf-8 -*- #coding=utf-8 import os """ A TestRunner for use with the Python unit testing framework. It generates a HTM 阅读全文
posted @ 2022-03-08 12:22 究极不吃香菜 阅读(118) 评论(0) 推荐(0) 编辑
摘要: python 生成日志文件及写入 def log_ging(): level = logging.DEBUG filename = 'test_log_' log_path = os.path.dirname(os.getcwd()) + '/baidu/baidu_logs/'#父目录路径 dat 阅读全文
posted @ 2022-03-07 18:28 究极不吃香菜 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 1、Unittest 是python内置的标准类库,它的API跟java的Junit、.net的NUnit、C++的CppUnit很相似,通过继承unittest.TestCase来创建一个测试用例。 2、 Doctest Doctest模块会搜索那些看起来像交互式会话的python代码片段,然后尝 阅读全文
posted @ 2022-03-03 16:38 究极不吃香菜 阅读(604) 评论(0) 推荐(0) 编辑
摘要: ##测试数据 表格数据转化为字典提供测试脚本使用, import sys,os from openpyxl import load_workbook add_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys. 阅读全文
posted @ 2022-03-02 17:46 究极不吃香菜 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 读取打开文件 with open(text_pat, 'r', encoding='utf-8') as r_f: #text_pat:文件路径 #'r' :打开方式/读写 OR 其他 #encoding: 编码格式 array = r_f.readlines()#读取多行文件,以列表的形式展示,如 阅读全文
posted @ 2022-03-02 11:25 究极不吃香菜 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 读取指定yaml文件数据 import yaml import sys,os add_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(add_path) path = os.path 阅读全文
posted @ 2022-03-01 18:12 究极不吃香菜 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 获取当前文件父级路径 path = os.path.dirname(__file__) 添加当前文件至环境变量 import sys,os add_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path. 阅读全文
posted @ 2022-02-28 18:19 究极不吃香菜 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 浏览器相关 #coding=utf-8 from selenium.webdriver import Chrome from selenium import webdriver driver = webdriver.Firefox() # driver = webdriver.Chrome driv 阅读全文
posted @ 2022-02-28 17:53 究极不吃香菜 阅读(120) 评论(0) 推荐(0) 编辑
摘要: from selenium import webdriver chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('disable-infobars') chrome_options.add_argument( 阅读全文
posted @ 2022-02-24 14:42 究极不吃香菜 阅读(580) 评论(0) 推荐(0) 编辑
摘要: 一、WebDriver规范 根据WebDriver规范(https://w3c.github.io/webdriver/#x4-interface)的描述,WebDriver定义了一个标准方法,以便于文档(document)判断当前浏览器处于自动化控制之中。 这个方法就是检测window.navig 阅读全文
posted @ 2022-02-24 11:34 究极不吃香菜 阅读(623) 评论(0) 推荐(0) 编辑