![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
奇异的喵星人
这个作者很懒,什么都没留下…
展开
-
Robotframework 改写框架新增用例控制
开发二次关键字,add test case 用于执行一个用例,而不是按RF框架本身的用例个数执行from __future__ import print_function# from .version import VERSION# __version__ = VERSIONclass DynamicTestCase(object): ROBOT_LISTENER_API_VERSION = 3 ROBOT_LIBRARY_SCOPE = 'TEST SUITE'原创 2022-02-16 19:39:16 · 350 阅读 · 0 评论 -
python pyecharts 数据可视化展示
from pyecharts import options as optsfrom snapshot_selenium import snapshot as driver def draw_chart(self, file, save_path): """ 前端回放性能用例数据统计图 file: excel完整路径 save_path: html 和 png 保存目录 """ data = pand.原创 2022-01-25 17:10:22 · 1075 阅读 · 0 评论 -
python 以管理员权限调用cmd命令
一,将要执行的cmd命令放到xx.bat文件里二,创建shell.vbs使系统以管理员权限运行cwd = CreateObject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Pathpath = cwd & "\RestartInternet.bat" Set shell = CreateObject("Shell.Application")shell.ShellExecut原创 2022-01-04 10:16:30 · 5120 阅读 · 1 评论 -
robot framework 调用js接口并获取返回值
${open_success}= Execute Javascript return window._FicAppObj.getDebugStatus();${result} Convert To String ${open_success}[open_file_success]Should Be Equal ${result} True原创 2021-12-29 19:59:10 · 771 阅读 · 0 评论 -
Python AES加密实现
import base64import binasciiimport refrom Crypto.Cipher import AESclass AESCBC: def __init__(self): self.key = 'asdf$%^123123adf'.encode('utf-8') # 定义key值 self.mode = AES.MODE_CBC self.bs = 16 # block size self..原创 2021-11-19 14:50:55 · 980 阅读 · 2 评论 -
Python3 中的encode和decode含义及字符数组转换
Python3中的encode和decodePython3中字符编码经常会使用到decode和encode函数。特别是在抓取网页中,这两个函数用的熟练非常有好处。encode的作用,使我们看到的直观的字符转换成计算机内的字节形式。decode刚好相反,把字节形式的字符转换成我们看的懂的、直观的、“人模人样”的形式。str转换成bytes:第一种方式:charArray = bytes(data.encode('utf-8'))第二种方式:charArray = b"test" # b原创 2021-11-19 14:31:25 · 1384 阅读 · 0 评论 -
Python 调用GO 动态库
因为python的AES加密结果和Go的加密结果总是对不上,最终只能让开发提供一个Go的加密库,用python来调用,保证加密结果是一样的。Go生成动态库的的搞法开发知道,就不写啦此处仅记录python 调用方式:Go 动态库接收和返回的其实是C_type格式,所以python调用也需要转换为相应的C_type格式,可参照此表转换if __name__ == "__main__": lib = cdll.LoadLibrary("C:\\Users\\ws\\Downlo.原创 2021-11-19 14:18:24 · 1096 阅读 · 1 评论 -
python websocket 连接
class WebSocket(object): def __init__(self, url, req): self.url = url self.req = req self.ws = '' def on_open(self): # 连接到服务器之后就会触发on_open事件,这里用于send数据 logger.info(self.req) self.ws.send(self.req) .原创 2021-11-02 11:37:00 · 1979 阅读 · 0 评论 -
python 单例模式日志封装
#!/usr/bin/env python# -*- coding: utf-8 -*-import osimport os.pathimport socketimport loggingimport logging.handlersimport timefrom common.singleton import singleton@singletonclass JFMlogging(object): logger = logging.getLogger() de.原创 2021-09-27 09:37:10 · 173 阅读 · 0 评论 -
Python Poium + allure 学习和实际应用
虫师封装的poium包:https://github.com/SeldomQA/poiumhttps://github.com/loveshanshan/poium使用范例:https://github.com/defnngj/pyautoTesthttps://github.com/arcat91/uitestwindows10 按照allure :http://www.manongjc.com/detail/9-hiahagqpcrvyfml.html...原创 2021-08-04 10:26:17 · 523 阅读 · 0 评论 -
python logging模块封装
# !/usr/bin/python# -*- coding:utf-8 -*-import loggingimport timeimport osclass Logger(object): ''' 封装后的logging ''' def __init__(self, logger=None, log_cate='default'): ''' 指定保存日志的文件路径,日志级别,以及调用文件 将日志存入到指定的.原创 2021-08-01 12:15:47 · 404 阅读 · 4 评论 -
Python+sikuli UI图像识别测试框架的使用
最近尝试做mac pc端应用程序的UI自动化,发现来一个图像识别的jar包工具,两种使用方法:1,直接下载jar包,启动jar包,使用GUI2,因为要与移动端协同操作在一个测试框架里,最后是集成到python, jar集成到python也有几种方式:a, 使用Jpython解释器(本人没有尝试),操作指南:https://sikulix-2014.readthedocs.io/en/latest/scenarios.html#using-jython-and-pythonb,使用pyjniu原创 2021-07-30 15:42:30 · 1533 阅读 · 0 评论 -
python实现mac PC客户端自动化调研
环境搭建:https://blog.csdn.net/a200822146085/article/details/112344650简单实践:https://www.jb51.net/article/187508.htmsikuli+python: 基于图像识别技术做UI自动化:sikuli [error] Mouse: not useable (blocked) --使用Java 11,重新配置系统偏好设置https://github.com/RaiMan/SikuliX1/wiki/Al原创 2021-07-29 17:52:26 · 1177 阅读 · 0 评论 -
Mac OS 搭建appium 环境
鉴于以前使用appium,搭建过程各种问题,推荐大家使用appium-desktop。安装brew, 推荐使用ruby + 国内镜像安装,MAC OS自带rubybrew install node安装sdk,设置环境变量,推荐安装全家桶 intelliJ IDEA + python plugin + SDK安装java, 设置环境变量升级python2 到 3:可参考https://blog.csdn.net/lc19920727/article/details/119032754?s.原创 2021-07-25 12:57:10 · 270 阅读 · 1 评论 -
Mac os python升级
MAC 系统自带python2,升级到python3的操作:brew install pythonbrew upgrade python安装结束后会有下面提示:If you need to have python@3.8 first in your PATH, run: echo 'export PATH="/usr/local/opt/python@3.8/bin:$PATH"' >> ~/.zshrcFor compilers to find python@3..原创 2021-07-23 14:09:12 · 718 阅读 · 0 评论 -
windows2007 python2.7 32bit env 安装pandas和ipython
一、pandas因为用pip 老提示timeout,设置代理也没用,设置timeout时间也不管事,后来单个安装包,总是少各种东西,装了一下午也没成功。最后在要放弃的时候,找到了一个最简单的办法那就是安装anaconda!!!它相当于一个容器:是一个用于科学计算的Python发行版,支持 Linux, Mac, Windows系统,提供了包管理与环境管理的功能,可以很方便地原创 2017-10-15 21:54:21 · 461 阅读 · 0 评论 -
python unittest的简单使用
一.首先创建两个测试类test1.py:#!/user/bin/env python#-*- coding: utf-8 -*-import osimport unittestclass test1(unittest.TestCase):def setUp(self):print "this test1 setup()"def tearDown(se原创 2017-07-12 17:28:23 · 337 阅读 · 0 评论 -
Python 读文件只读了一部分的问题解决
Python 在读文件时,只读了一部分,可能是由于文件中含有乱码,导致读取时遇到这个乱码字符时认为文件终止了。解决办法:读取时加'rU'参数: log = open(self.logpath,'rU') for line in log.readlines(): print line原创 2017-07-12 17:27:18 · 4574 阅读 · 0 评论 -
python 爬虫动态加载网站
找到网页动态加载的url变化规律,比如此次试验中是http://www.wjdiankong.cn/page/num/ ; num从1自增#!/user/bin/env python#-*- coding: utf-8 -*-import re import urllib2 import urllib import cookielib import原创 2017-05-30 13:51:16 · 634 阅读 · 0 评论 -
python 计算hash值与java不一致问题
使用Python进行文件Hash计算有两点必须要注意:1、文件打开方式一定要是二进制方式,既打开文件时使用b模式,否则Hash计算是基于文本的那将得到错误的文件Hash(网上看到有人说遇到Python的Hash计算错误在大多是由于这个原因造成的)。2、对于MD5如果需要16位(bytes)的值那么调用对象的digest()而hexdigest()默认是32位(bytes),同理Sh原创 2016-11-16 15:31:56 · 5469 阅读 · 0 评论