随笔分类 -  自动化测试

摘要:一、python实现读取验证码from PIL import Imageimport pytesseractimport osimport requestsimport jsonimport base64# 获取当前目录dir = os.getcwd()# 请求图片验证码result = reque 阅读全文
posted @ 2025-07-11 10:03 爱我所爱-333 阅读(191) 评论(0) 推荐(0)
摘要:1、 描述: 今天想抓取一个网站跳转到另外一个页面的数据,结果一直报元素获取不到,用了xpath、id、class都没办法,找了很久的解决方案,增加如下二行即可成功: # 获取所有的窗口,句柄all_handles = driver.window_handles# 切换到新打开的窗口driver.s 阅读全文
posted @ 2021-04-22 11:09 爱我所爱-333 阅读(680) 评论(0) 推荐(0)
摘要:import timeimport osimport sysdef merge_hosts(): def read_hosts(filename): res = [] with open(filename, 'r') as f: for line in f.readlines(): ls = lin 阅读全文
posted @ 2020-03-09 16:36 爱我所爱-333 阅读(301) 评论(0) 推荐(0)
摘要:自动化测试代码测试过程中,如果多个环境的项目放在一套代码,每次手动切换不是很方便,如下代码则可实现 # hosts.PY(实现代码) # coding=utf-8# '''a测试环境(根据自己的环境设置)'''zg_sides = ['14.215.177.39 www.baidu.cn', '14 阅读全文
posted @ 2019-12-04 14:39 爱我所爱-333 阅读(454) 评论(0) 推荐(0)
摘要:记录一下做压力测试过程中,需要用到参数化(获取数据库满足条件的记录并将结果写入到text中)我这次用到二个接口参数化则用了unittest:# -*- coding:utf-8 -*-import unittestimport pymysqlclass Content(unittest.TestCa 阅读全文
posted @ 2019-12-04 14:19 爱我所爱-333 阅读(1282) 评论(0) 推荐(0)
摘要:from threadpool import ThreadPool, makeRequestsimport websocketimport threadingdef on_message(ws, message): print(message)def on_error(ws, error): pri 阅读全文
posted @ 2019-11-12 11:14 爱我所爱-333 阅读(1643) 评论(0) 推荐(0)
摘要:# 连接数据库import pymysqlconn = pymysql.connect( host="数据库主机", port=端口, user='用户名', passwd='密码', charset='utf8')cur = conn.cursor()# 获取所有数据库信息cur.execute( 阅读全文
posted @ 2019-11-12 11:04 爱我所爱-333 阅读(826) 评论(0) 推荐(0)