![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
解决疑难杂症
小马798
流水不争先,争的是滔滔不绝
展开
-
Selenium+python,切换frame,定位元素出现NoSuchElementException异常
加了等待时间,没有层级frame,没有新打开标签,情况单一,代码简单,还是定位不到元素!这个时候你就要考虑定位的元素的属性是动态的了! (初学selenium,有些解释不明确的地方,多包涵~) 动态属性,就是每次打开页面,元素的id、class等属性是不一样的(动态生成)。执行代码定位元素时,重新打开页面,属性值变化,而你定位元素使用的是上一次访问页面生成的属性值,这样自然是定...原创 2018-12-07 17:18:22 · 825 阅读 · 1 评论 -
TypeError: unbound method maximize_window() must be called with WebDriver instance as first argument
在学习Python+selenium时,出现TypeError: unbound method maximize_window() must be called with WebDriver instance as first argument (got nothing instead)错误,大概意思就是WebDriver没有被实例化,不能调用maximize_window()方法。报错原因是...原创 2018-12-21 11:41:42 · 710 阅读 · 0 评论 -
Python unittest单元测试,不执行if __name__ == '__main__'
代码没问题,运行也不报错,但是就没有达到预期结果。测试代码如下:# -*- coding:utf-8 -*-import unittestimport timefrom selenium import webdriverclass UnitTestBaidu(unittest.TestCase): def setUp(self): self.drive...原创 2018-12-26 23:18:58 · 1743 阅读 · 0 评论 -
python unittest调用TestCase报错,unittest无法调用TestCase
在学习Python的单元测试框架unittest时,创建类需要继承unittest.TestCase,但继承时始终无法调用TestCase。原因是我的文件名命名为unittest,因为unittest是Python内置的模块,导入unittest时会优先查找我定义的unittest,所以无法调用TestCase。解决办法是把我的文件重命名。...原创 2018-12-24 22:14:54 · 4108 阅读 · 1 评论 -
安装libimobiledevice失败,Requested 'libusbmuxd >= 1.1.0' but version of libusbmuxd is 1.0.10
执行以下命令brew install --HEAD libimobiledevice返回一堆吧啦吧啦的东西,总之就是没安装成功,其中有几行信息是这样的configure: error: Package requirements (libusbmuxd >= 1.1.0) were not met:Requested 'libusbmuxd >= 1.1.0' but...原创 2019-07-17 17:36:25 · 1347 阅读 · 0 评论 -
TypeError: testlogin() takes 1 positional argument but 2 were given
TypeError: testlogin() takes 1 positional argument but 2 were given错误意思是 testlogin()方法只需要一个参数,但是实际给了两个参数。下面的代码块是调用 login.py 文件下 Login类 下的 test_login( ) 方法 def test_case(self): #执行的测试用例...原创 2019-07-24 18:41:28 · 4524 阅读 · 1 评论 -
python3+appium HtmlTestRunner生成报告,环境配置
HtmlTestRunner简介HtmlTestRunner是将单元测试的结果保存为html格式的测试报告的工具,这个工具的功能和HTMLTestRunner很像,而且名称也很像。但是它支持python3,而且生成的报告的样式更加美观。安装HtmlTestRunner访问下面链接,下载html_testRunner-1.2-py2.py3-none-any.whl文件网盘链接:ht...翻译 2019-07-26 21:26:41 · 244 阅读 · 0 评论