摘要: find_element_by_id html中id=‘xxxx’,页面中id是唯一的 find_element_by_name html中name=’xxxx’ 可以有多个,如果出现多个,使用find_elements find_element_by_xpath 通过xpath信息 使用xpath 阅读全文
posted @ 2017-09-22 18:01 hellowcf 阅读(398) 评论(0) 推荐(0) 编辑
摘要: 通过id定位 安卓里面的id即为resource-id driver.findElementById("com.tencent.mm:id/do") 或者 WebElement element = driver.findElement(By.id("com.tencent.mm:id/do")); 阅读全文
posted @ 2017-09-22 17:59 hellowcf 阅读(491) 评论(0) 推荐(0) 编辑
摘要: 模型元数据Meta是“任何不是字段的数据”,比如排序选项(ordering),数据库表名(db_table)或者人类可读的单复数名称(verbose_name 和verbose_name_plural)。在模型中添加class Meta是完全可选的,所有选项都不是必须的。 Django模型类的Met 阅读全文
posted @ 2017-08-30 14:53 hellowcf 阅读(297) 评论(0) 推荐(0) 编辑
摘要: 定义模型 将数据库表定义成类,集成models.Model from django.db import models # Create your models here. class Author(models.Model): name=models.CharField(max_length=100 阅读全文
posted @ 2017-08-30 14:52 hellowcf 阅读(1785) 评论(0) 推荐(0) 编辑
摘要: Admin注册 内容发布的部分由网站的管理员负责查看、添加、修改、删除数据,开发这些重复的功能是一件单调乏味、缺乏创造力的工作,为此,Django能够根据定义的模型类自动地生成管理模块。 1)准备工作:创建管理员的用户名和密码。 python manage.py createsuperuser 按提 阅读全文
posted @ 2017-08-30 14:52 hellowcf 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 请求一张页面时,Django把请求的metadata数据包装成一个HttpRequest对象,然后Django加载合适的view方法,把这个HttpRequest 对象作为第一个参数传给view方法。任何view方法都应该返回一个HttpResponse对象。 我们在本书中大量使用这两个对象;本附录 阅读全文
posted @ 2017-08-30 14:50 hellowcf 阅读(362) 评论(0) 推荐(0) 编辑
摘要: unittest没有想testNG那么方便,可以进行参数化,但是有一个第三方库可是实现参数化 安装 pip install parameterized 该库可以在python的所有单元测试框架中使用 具体的使用方法及使用方法可参考官网 https://pypi.python.org/pypi/par 阅读全文
posted @ 2017-08-24 11:47 hellowcf 阅读(1828) 评论(0) 推荐(0) 编辑
摘要: 使用HTMLTestRunner想生成测试报告,尝试了很多次了,就是无法生成,在百度搜索发现是快捷键问题 工具:Pycharm Ctrl+Shift+F10运行不会生成脚本 Alt+Shift+F10运行生成脚本 使用HTMLTestRunner想生成测试报告,尝试了很多次了,就是无法生成,在百度搜 阅读全文
posted @ 2017-08-17 15:40 hellowcf 阅读(257) 评论(0) 推荐(0) 编辑
摘要: Collections主要功能 Counter 类 defaultdict 类 namedtuple 类 deque类 orderedDict类 Counter 是一个有助于 hashable 对象计数的 dict 子类。它是一个无序的集合,其中hashable对象的元素存储为键,它们的计数存储为值 阅读全文
posted @ 2017-08-11 10:51 hellowcf 阅读(151) 评论(0) 推荐(0) 编辑
摘要: retry(exceptions=Exception, tries=-1, delay=0, max_delay=None, backoff=1, jitter=0, logger=logging_logger): """Return a retry decorator. :param except 阅读全文
posted @ 2017-08-11 10:50 hellowcf 阅读(3373) 评论(0) 推荐(0) 编辑