自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(26)
  • 收藏
  • 关注

原创 Ansible在macOS上的安装部署

Ansible 的主要配置文件是 /etc/ansible/ansible.cfg,但也可以在项目目录中创建一个 ansible.cfg 文件来覆盖默认配置。ansible_ssh_private_key_file # 秘钥文件如果不想使用ssh-agent管理时可以使用此选项。ansible_ssh_user # ssh连接时默认使用的用户名。ansible_ssh_pass # ssh连接时的密码。ansible_ssh_host # 要连接的主机名。

2024-04-18 17:02:14 1277

原创 Jenkins机器已经安装了ansible, 运行的时候却报错ansible: command not found

直接在Jenkins 机器中,进入一样的目录执行。Jenkins log提示。试试Jenkins 运行。求大神解答问题出在哪?操作系统:MacOS。

2024-04-17 11:14:05 376

原创 【shell脚本】在指定时间内查找Installer进程,如果存在则kill

从当前时间+TimeSpan,开始循环查找Process name 为 Installer的进程。if [ -n “$pid” ] 判断变量是否为空,若不为空,则kill 经常,跳出循环。

2023-11-22 14:51:21 112

原创 Python3从Excel中读接口测试数据和需要检查的响应内容

运行一下,看下log成了,不用一遍遍改postman啦,就直接把测试数据放到Excel中,也有log方便回顾测试结果。接口测试,包含有多种测试场景,检查response。只是一次性测试,就不弄啥测试框架了哈,简单看看。包含request 和response需要检查的code、result_code、message等。最后再调用request 和 assertion,完工。封装assertion。

2023-05-10 10:58:55 206

原创 使用Mac终端给文件夹加密压缩

首先进入文件目录cd ~/Desktop否则的话,压缩出来的文件会包含长长的文件路径,就像下面这样zip -er [zip file name] [file name]zip file name 是即将要生成的zip包的名字,当前路径下是不存在的file name 是要生成zip包的文件夹名,当前路径下是存在的-er 加密文件夹-e 加密文件根据提示输入加密文件的密码举个栗子...

2022-04-15 10:01:27 3902

原创 【MAC终端UI自动化】获取当前最前端的应用程序

目的:在操作当前应用后,弹出一个系统弹窗,想定位到这个弹窗方法一(没搞定,期待大佬解答):想到atomac有个获取当前最前端的应用程序的方法getFrontmostAppa = atomac.getFrontmostAppprint(a)返回<bound method BaseAXUIElement.getFrontmostApp of <class 'atomac.AXClasses.NativeUIElement'>>没走到方法里去?所以根据返回改成a =

2022-04-14 16:26:49 613

原创 【MAC终端UI自动化】使用atomac对下拉框PopUp Button中元素操作

目标:选择下拉框中的“Updates Received”首先踩坑识别到这个PopUp Button之后,显示Children:Empty array下面没有其他元素了之后使用_menuItem 等各种方法,都有各种报错解决步骤:用getAttributes()获取元素上可用属性的列表,打印出来有这些属性['AXEnabled', 'AXFrame', 'AXParent', 'AXSize', 'AXFocused', 'AXChildren', 'AXRole', 'AXTopLeve

2022-04-12 15:41:15 1027

原创 【MAC终端UI自动化】pyautogui.click,图像识别定位不准排查

原始代码,点不到图片位置x,y = pyautogui.locateCenterOnScreen(image='1.png')pyautogui.click(x,y)排查一:没有鼠标点击的权限打开系统偏好设置->安全与隐私->在‘允许下面的APP控制您的电脑’中将终端打上对勾。验证:pyautogui.click(0,0)可以点击到最左上的苹果图标,说明点击方法没有问题,只是点击位置错误。排查二:分辨率问题看屏幕尺寸:#获取图片位置x,y = pyautogui.loc

2022-04-08 17:22:13 4112 4

原创 /Library/Developer/CommandLineTools/usr/bin/python3 :NO module named pytest解决

报错场景:已经用pip3 install pytest 成功下载pytest,结果运行python3 -m pytest xxx.py还是报错/Library/Developer/CommandLineTools/usr/bin/python3 :NO module named pytest原因:可能没有使用正确的PIP和正确的Python解释器。解决方案:python3 -m pip install pytest --user(如果在系统范围内安装,可以省略–user)。...

2022-04-07 11:24:50 3953

原创 python+pytest参数化,使用parametrize或yaml文件

方法一:在测试用例前加上@pytest.mark.parametrize(“参数名”,列表数据)参数名:用来接收每一项数据,并作为测试用例的参数。列表数据:一组测试数据。示例:@pytest.mark.parametrize("account, password", [('abc', '123456')])def test_login(self,account, password): Course_Page.follow() Login_Page.login(accou

2021-10-25 21:06:08 2187

原创 TypeError: load() missing 1 required positional argument: ‘Loader‘

最近使用yaml.load()时报错 TypeError: load() missing 1 required positional argument: ‘Loader’记录原因:YAML 5.1版本后弃用了yaml.load(file)这个用法,因为觉得很不安全,5.1版本之后就修改了需要指定Loader,通过默认加载​​器(FullLoader)禁止执行任意函数,该load函数也变得更加安全用以下三种方式都可以d1=yaml.load(file,Loader=yaml.FullLo

2021-10-22 14:25:41 39809 6

原创 airtest如何在剪贴板写数据,写特殊符号&

想在粘贴板写数据,让app打开后读取粘贴板路由,直接跳转目标页一开始试了win32的复制粘贴,结果不行。猜测是airtest并不支持,也可能是我能力不够,如有他人成功,欢迎留言给我。后来用adb shell,电脑连接手机,可以成功,但是在airttest中运行有报错代码如下,dev = connect_device("android://127.0.0.1:5037/devicexxxxxx")dev.shell("adb shell am startservice ca.zgrs.clipper

2021-10-13 10:36:05 1524 2

原创 airtest创建守护进程等待apk安装完成

from airtest.core.api import *from threading import Threadauto_setup(__file__)from poco.drivers.android.uiautomation import AndroidUiautomationPocopoco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)def input_pw():

2021-10-11 16:06:13 452

原创 python3 批量执行参数化insert语句

import syssys.path.append('D:\python_test_live')import pymysqlfrom course.customer import dict_data_richer,dict_data_course# 创建连接对象db = pymysql.connect(host='xxxx', port=xxx, user='xxx', password='xxx', database='xxx', chars

2021-06-07 17:03:20 592

原创 Python3导入同一个文件夹下不同文件,报错ImportError: attempted relative import with no known parent package

项目目录是这样的,想在api_test里面引入customer一开始是这个么写的,结果报错ImportError: attempted relative import with no known parent packagefrom .customer import dict_dataprint (dict_data)看了网上说根目录和子目录都新建__init__.py,试了并没有效果又试了下,把相对路径写成绝对路径,改成下面这样,报错ModuleNotFoundError: No modu

2021-06-04 17:43:41 876

原创 airtest上的滑动操作swipe

正常来说,方法一的滑动是生效的,但是在页面有蒙层或是其他怪异的情况下,可能就不生效了,再用方法二方法一:# 获取设备的高度和宽度width, height = device().get_current_resolution()# 校准滑动的起点和终点start_pt1 = (width / 2,height * 0.9)end_pt1 = (width / 2,height * 0.1)start_pt2 = (width *0.9,height / 2)end_pt2 = (width

2021-04-27 15:46:59 6029 1

原创 airtest之检查点

assert_exists(“图片”, “请填写测试点”)assert_not_exists(“图片”, “请填写测试点”)assert_equal(“实际值”, “预测值”, “请填写测试点.”)assert_not_equal(“实际值”, “预测值”, “请填写测试点.”)下面是实际操作的两个案例try: assert_exists(Template("图片", "页面上存在主播发言")except AssertionError: print("主播发言失败") va

2021-04-22 11:42:25 575

原创 python3 + selenium 中driver.get()报错问题

原代码:def shot(self):# open in webpagechrome_options = webdriver.ChromeOptions()chrome_options.add_argument(’–headless’)chrome_options.add_argument(’–disable-gpu’)chrome_options.add_argument(’–no-sandbox’)chrome_options.add_argument(’–disable-dev-shm-

2021-04-16 14:30:39 4566

原创 python3发送测试报告截图(正文中显示截图)和html附件

#! /usr/bin/env python3'''i'm pot'''# import pysnooperimport smtplibimport base64from email.mime.multipart import MIMEMultipartfrom email.mime.text import MIMETextfrom email.header import Headerimport os,sysimport timeimport globfrom PIL im

2021-04-16 12:04:47 342

原创 python连接数据库,且sql中参数从csv文件中读取,再把sql执行结果写入csv文件

import pandasimport pymysqlimport csv# 创建连接对象conn = pymysql.connect(host='xxx', port=3306, user='xxx', password='xxx', database='xxx', charset='utf8')# 获取游标对象cursor = conn.cursor()path = 'id.csv'#读CSV文件data = pandas.read_c

2020-12-16 16:27:43 533 1

原创 requests.post()提取返回数据中的具体某个数值

返回json数据是这样的,提取返回code:rsp = requests.post(url,data=jsonData,headers=headers,timeout = 3).json()code = rsp['code']if code != 1000 : print(rsp)else: print("管理员列表输出成功")提取返回的第一个user_id:rsp = requests.post(url,data=jsonData,headers=headers,time

2020-11-26 14:56:11 6950 1

原创 python连接数据库

# encoding:utf-8import pymysql# 创建连接对象conn = pymysql.connect(host='xxx', port=3306, user='xxx', password='xxx',database='xxx', charset='utf8')# 获取游标对象cursor = conn.cursor()# 查询 SQL 语句sql = "SELECT xxx FROM `xxx` WHERE xxx= xxx;"# 执行 SQL 语句 返回值就是

2020-11-19 17:12:04 74

原创 python读取CSV文件

reader读取csv文件,再用for循环遍历import csvwith open('customer.csv')as f: f_csv = csv.reader(f) for row in f_csv: print(row[0])运行结果[‘id’, ‘test’][‘932467’, ‘1111’][‘932468’, ‘2’][‘932469’, ‘3’][‘15896317’, ‘4’][‘15896319’, ‘5’][‘15896324’,

2020-11-19 17:08:45 111

原创 python+requests中data的写法

常规写法data ={ "anchor_user_id": 922442, "token": "4a4fdd9f125aa594bb1024c2ce12e404", "user_id": 15896319 } 接口报错1007 print data发现双引号变单引号解决办法data用’’’ ‘’'包围...

2020-11-09 19:47:20 2192

原创 UI自动化如何使用appium键盘直接输入中文

#使用unicode 编码方式发送字符串desired_caps['unicodeKeyboard'] = True#resetKeyboard将键盘隐藏起来desired_caps['resetKeyboard'] = Trueself.driver.find_element_by_id("com.lanjingren.ivwen:id/v_edit").send_keys(u"直接输入中文咯")自动化测试完成后,手机键盘打不开咋办?怎么再把手机键盘还原?方法一: 设置–常规管理–语言和输

2020-09-23 17:20:51 745

原创 检查点设置中文对比,报错UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0xe5 in position 108: ordinal not的解决

https://blog.csdn.net/Hanani_Jia/article/details/77950594源博客地址首先,我先对GitHub来一个简单的介绍,GitHub有一个很强大的功能就是,你在服务器上边可以创建一个库(稍后会介绍怎么创建),写代码是一件很重的任务,尤其是很多人完成一个很大的项目的时候,就十分的复杂,一群人一起来写某个项目,大家完成的时间,完成的进度都是不相同的,你写...

2020-09-23 17:11:09 167

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除