Fork me on GitHub

08 2018 档案

摘要: #coding=utf-8 from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait base_url = "http://www.baidu.com" driver = webdriver.Firefox() driver.implicitly_wait(5) '''隐式等待和显示等待都存在时,超时时间取二者中较大的''' locator = (By.ID,'kw') driver.get(base_url) 阅读全文
posted @ 2018-08-28 16:54 linux超 阅读(652) 评论(0) 推荐(0)
摘要: 一、什么是unittest 这里我们将要用的unittest是python的单元测试框架,它的官网是 https://docs.python.org/2/library/unittest.html,在这里我们可以得到全面的信息。 当我们写的用例越来越多时,我们就需要考虑用例编写的规范与组织,以便于后期的维护,而unittest正是这样一款工具。我们这里用一个示例来展示用unittest脚本是什么样子的 阅读全文
posted @ 2018-08-20 12:32 linux超 阅读(4325) 评论(1) 推荐(4)
摘要: selenium Python 总结一些经常使用到的API。 1.获取当前页面的Url 2.获取元素坐标 3.表单的提交 4.获取CSS的属性值 5.获取元素的属性值 6.判断元素是否被选中 7.返回元素的大小 8.判断元素是否显示 9.判断元素是否被使用 10.获取元素的文本值 11 阅读全文
posted @ 2018-08-15 15:03 linux超 阅读(698) 评论(0) 推荐(1)