接口自动化-->文件下载
摘要:url ='XXX' cookies ={"id":"123456"} res =requests.get(url,cookies=cookies) if res.status_code == 200: #写入文件 with open('F:\\script\\download\\test_05.z
阅读全文
posted @
2021-06-28 17:56
fishing~
阅读(92)
推荐(0) 编辑
接口自动化-->文件上传
摘要:接口请求: import requests #上传接口的参数 files = {"projectFile": ('sub_process.json', open("F:\\上传文件\\task_01.json", 'rb'), "application/json")} #参数说明: #project
阅读全文
posted @
2021-06-28 17:20
fishing~
阅读(317)
推荐(0) 编辑
selenium-->键盘操作
摘要:import time from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from
阅读全文
posted @
2021-06-28 14:25
fishing~
阅读(31)
推荐(0) 编辑
selenium-->鼠标操作
摘要:import time from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from
阅读全文
posted @
2021-06-28 14:24
fishing~
阅读(34)
推荐(0) 编辑
接口自动化-->数据库操作
摘要:#mysql操作 #安装pymysql,pip install pymysql from pymysql.cursors import DictCursor import pymysql #1、建立连接 con =pymysql.connect(host='地址', user='用户名', pass
阅读全文
posted @
2021-06-03 09:58
fishing~
阅读(15)
推荐(0) 编辑
json和字典之间的转换
摘要:import json #json字符串转换字典 data ='{"a":1,"b":2,"c":null}' data_dict =json.loads(data) # print(data_dict) #{'a': 1, 'b': 2, 'c': None} #字典转换json字符串 dict_
阅读全文
posted @
2021-06-01 16:45
fishing~
阅读(93)
推荐(0) 编辑
接口自动化-->配置文件
摘要:#配置文件 #1、python文件 # class ConfigFile: # name ="hhh" # age ="18" # print(ConfigFile.name) #2、yaml文件 #1、创建yaml格式文件 #2、安装yaml,pip pyyaml #3、导入 import yam
阅读全文
posted @
2021-06-01 11:03
fishing~
阅读(8)
推荐(0) 编辑
接口自动化-->日志处理
摘要:import logging #日志级别: """ 1、debug:调试信息 2、info:主体功能信息,流水 3、warning:警告 4、error:错误 5、critical:严重的,致命的 """ #级别定义 logging.error("这是一条错误信息") #日志收集器: #1、日志收集
阅读全文
posted @
2021-06-01 11:01
fishing~
阅读(16)
推荐(0) 编辑
接口自动化-->前后置条件&ddt
摘要:import os import ddt import unittest from test.test_api.excel_handler import ExcelHandler @ddt.ddt class TestCls(unittest.TestCase): dir_name = os.pat
阅读全文
posted @
2021-06-01 11:00
fishing~
阅读(16)
推荐(0) 编辑
接口自动化-->excel操作
摘要:import os import openpyxl data_path =os.path.dirname(os.path.abspath(__file__)) file_path =os.path.join(data_path,'data.xlsx') #工具:openpyxl、tablib、pan
阅读全文
posted @
2021-06-01 10:57
fishing~
阅读(17)
推荐(0) 编辑