摘要: 回调函数:传入函数名称,在函数内调用该函数,传参,在特定的地方执行 def sum(a,b,callback): c = a+b callback(c) def s_print(msg): print("callback:%s"%msg) def s_print2(msg): print("call 阅读全文
posted @ 2024-09-03 17:34 2020不在低调 阅读(49) 评论(0) 推荐(0)
摘要: 1, 代码内调用管理员权限执行一个exe文件 if is_admin(): os.startfile("system-jg_new.exe") else: if sys.version_info[0] == 3: ctypes.windll.shell32.ShellExecuteW(None, " 阅读全文
posted @ 2021-09-26 11:30 2020不在低调 阅读(2855) 评论(0) 推荐(0)
摘要: 1, 定位普通带空格的文本 例如定位 <a> 登录 </a> //*[normalize-space(text())="登录"] 或者<a> 登录 </a> //*[normalize-space(text())="登录"] 2,定位的文本标签中带有 <th><script> ABCD("123", 阅读全文
posted @ 2021-01-21 11:53 2020不在低调 阅读(943) 评论(0) 推荐(0)
摘要: 1,安装 tesseract工具,配置tesseract.exe的环境变量, 2, 安装 pytesseract 2,获取截图 3,可以通过Image的open或者cv2的imread打开图片,之后对图片进行对比度增强,降噪等处理,效果会好一些。 对于只获取图片部分文字的,可以先对图片进行裁剪 fr 阅读全文
posted @ 2020-08-27 16:00 2020不在低调 阅读(259) 评论(0) 推荐(0)
摘要: 一, os os.getcwd() # 获取当前文件所在的路径 os.curdir # 表示当前路径 . cd . os.pardir # 表示上一层目录 .. cd .. os.makedirs('dirname1/dirname2') # 生成多级递归目录 os.removedirs('dirn 阅读全文
posted @ 2020-08-01 18:00 2020不在低调 阅读(111) 评论(0) 推荐(0)
摘要: 1,pytest 添加 setup和teardown A, 以特定名称来为所有用例进行设置 1 class TestCase(): 2 def setup_class(self): 3 print(" 在整个类测试开始之前执行一次 ") 4 5 def teardown_class(self): 6 阅读全文
posted @ 2020-07-23 11:03 2020不在低调 阅读(132) 评论(0) 推荐(0)
摘要: dict --> json jsoninfo = json.dumps(dict) json --> dict dictinfo = json.loads(json) 获取指定长度的字符串,原有字符串右侧对其,左侧填充0 '1'.zfill(4) > '0001' 阅读全文
posted @ 2020-05-20 10:51 2020不在低调 阅读(199) 评论(0) 推荐(0)
摘要: 如下图,需要处理弹出框的登录操作 1,使用火狐浏览器可直接使用地址登录 http://username:password@192.168.0.1/ 2, 所有浏览器的通用解决方法 a.使用selenium打开浏览器 b.使用python多线程和autoit库去操作浏览器页面,完成输入点击的操作 阅读全文
posted @ 2020-05-16 14:41 2020不在低调 阅读(322) 评论(0) 推荐(0)
摘要: import copy >>> a = [1,2,3,[1,2,3]] >>>b = a = 直接赋值,a, b指向同一个对象 >>>b >>>[1,2,3,[1,2,3]]>>> c = copy.copy(a) copy.copy(), 浅复制,a, c指向不同的对象,但是他们的子对象还是指向同 阅读全文
posted @ 2020-05-12 20:03 2020不在低调 阅读(146) 评论(0) 推荐(0)
摘要: 当页面元素被隐藏时,可用执行JavaScript来代替操作 点击 Execute Javascript $('.advButton').click() 赋值 Execute Javascript $('#kw').val('abc') 阅读全文
posted @ 2020-04-21 14:41 2020不在低调 阅读(444) 评论(0) 推荐(0)