![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
张喵喵是小仙女
这个作者很懒,什么都没留下…
展开
-
python+selenium+webdriver 截取全页面长图
有的时候我们要截取整个页面,而不是当前的屏幕。python+selenium+webdriver 截取全页面长图,from selenium import webdriverimport timeimport os.pathimport multiprocessing as mpfrom selenium.webdriver.chrome.options import Op...原创 2019-01-10 16:01:09 · 18613 阅读 · 25 评论 -
MAC,python自动化上传文件的方法(模拟键盘法)
最近在写webUI的自动化测试,遇到文件上传的情况,这里采用了模拟键盘的方法,但是在模拟键盘输入时,遇到了一个问题,就是文件路径开头的斜杠/输入不进去,例如file赋值为‘/User/zhangmiaomiao/Doucument/test.jpg’,文件路径开头的斜杠/没有输入进去,只输入了User/zhangmiaomiao/Doucument/test.jpg,原因不明,这里提供一个临时...原创 2019-09-02 20:46:47 · 5283 阅读 · 7 评论 -
python报错——TypeError: Cannot create a consistent method resolution
TypeError: Cannot create a consistent method resolution这个报错的因为在函数继承类时,有一个类与父类继承的类重复啦~例如:class A: passclass B(A): passclass C(B,A): passruntest=C()运行后报错:TypeError...原创 2019-09-02 17:15:52 · 4960 阅读 · 6 评论 -
python-获取excel数据
import xlrdclass ExcelUtil(): def __init__(self, excel_path=None, index=None): if excel_path == None: excel_path = '/Users/zhangnana3/Desktop/Learning/Config/casedata.xls'...原创 2019-08-08 16:44:26 · 205 阅读 · 0 评论 -
python-快速排序
def Partitions(list, low, high): left = low right = high base = list[low] while left < right: while list[left] <= base: left = left + 1 while list[ri...原创 2019-08-08 16:42:04 · 97 阅读 · 0 评论 -
python-归并排序
# 归并排序'''归并排序采用分而治之的原理:1.将一个序列从中间位置分成两个序列2.再将两个子序列按照第一步继续二分下去3.直到所有子序列的长度都为1,也就是不可以再二分为止,这时候再两两合并成一个有序序列'''def merge(a, b): c = [] h = j = 0 while j < len(a) and h < len(b):...原创 2019-08-08 16:41:16 · 129 阅读 · 0 评论 -
python-合并两个有序列表
# 将两个排好序的列表合并def merge(list1, list2): list3 = [] while len(list1) > 0 and len(list2) > 0: if list1[0] < list2[0]: list3.append(list1[0]) del list1[0]...原创 2019-08-08 16:40:15 · 2032 阅读 · 0 评论 -
python-统计文件中单词出现的频率个数
def count_word(): count = {} with open('test.txt',) as f: lines = f.readlines() for line in lines: word = line.strip().split(' ')[0] print(word) if word in...原创 2019-08-08 16:38:49 · 4797 阅读 · 5 评论 -
python-判断括号是否匹配
BRACKET = {'}': '{', ')': '(', ']': '['}BRACKET_L, BRACKET_R = BRACKET.values(), BRACKET.keys()def Check_bracket(s): arr = [] for c in s: if c in BRACKET_L: # 左括号入栈 ...原创 2019-08-08 16:36:59 · 7083 阅读 · 2 评论 -
selenium,启动Safari浏览器,报错“You must enable the 'Allow Remote Automation' option in Safari's Develop me”
selenium在启动Safari浏览器,报错“You must enable the 'Allow Remote Automation' option in Safari's Develop me”,原因是需勾选safari-开发-允许远程自动化。如图。...原创 2019-01-23 21:22:39 · 3900 阅读 · 0 评论 -
元素定位不到问题1-----selenium,切换frame(iframe)
最近遇到一个问题,元素怎么都定位不到,原因是有iframe标签,利用switch_to.frame()方法跳入frame,然后再进行定位。#switch_to.frame()跳入frameself.driver.switch_to.frame("login_frame")在过程中还遇到一个问题就是,在Chrome浏览器中运行没有问题,但是在firefox浏览器中却报错了,原因是因为没有...原创 2019-01-23 21:10:16 · 1370 阅读 · 2 评论 -
python3 HTMLTestRnner.py
"""A TestRunner for use with the Python unit testing framework. Itgenerates a HTML report to show the result at a glance.The simplest way to use this is to invoke its main method. E.g. impor...原创 2019-01-11 17:30:37 · 181 阅读 · 0 评论 -
Can not connect to the Service chromedriver的解决方法
hosts文件里面 需要配置:127.0.0.1 localhost原创 2019-01-10 18:37:13 · 1651 阅读 · 1 评论 -
python报错问题,TypeError: _locateAll_python() got an unexpected keyword argument 'confidence
locateonscreen 函数添加confidence参数后报错,提示TypeError: _locateAll_python() got an unexpected keyword argument 'confidence‘解决办法:需要先安装opencv,pip install opencv-python...原创 2019-09-04 17:44:27 · 5177 阅读 · 3 评论