selenium-6 测试脚本中等待方法
2017-12-20 12:55
176 查看
![](http://i2.51cto.com/images/blog/201712/20/8dd33f4d15ebff5860f0f62e7d38b2d5.jpg?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
例1:
from selenium import webdriver
b = webdriver.Firefox()
b.find_element_by_id("kw").send_keys("51cto")
b.implicitly_wait(5) #等待五秒
b.find_element_by_id("kw1") #此处kw1是不存在的,因为使用了b.implicitly_wait()方法,所以查询5秒后超时了才报错
例2:WebDriverWait在脚本中的应用
![](http://i2.51cto.com/images/blog/201712/20/7a8eaff8d8dad1bca9a24a2b1a6a45e1.jpg?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
相关文章推荐
- selenium+python关于登录的脚本代码,使用了读取excel以及向excel中写入测试结果的方法
- 测试脚本中的等待方法
- selenium python 测试google脚本
- Flask SQLAlchemy 脚本测试方法
- selenium测试(Java)-- 显式等待(九)
- 举例详解PHP脚本的测试方法
- Selenium实战脚本集(3)--抓取infoq里的测试新闻
- Python+Selenium框架设计篇之6-一个类文件多个测试方法情况下测试固件的写法
- Python+Selenium框架设计篇之10-unittest执行脚本方法之discover()方法
- Java后台执行Shell脚本, Java方法不用等待Shell程序执行完成并保证关掉Java程序Shell脚本正常运行
- selenium grid解决多台电脑进行并发执行测试脚本
- python selenium 完整测试脚本
- Python使用Selenium测试WebApp在定位元素和使用元素属性报的莫名其妙错误的终极解决方法
- 初学者的Selenium自动化测试指南,基于Python(六)——如何设置元素等待
- python 自动化测试脚本-->selenium应用
- 基于《Selenium 2自动化测试实战》的学习笔记(11)—— 设置等待时间
- 基于Selenium的Web自动化测试脚本在IE上运行慢的解决方法
- python--selenium实用的自动生成测试HTML报告方法--HTMLTestRunner
- selenium使用testNG测试框架编写webdriver脚本_05
- Selenium的RC方式编写的测试脚本部分迁移到WebDriver方式混用的简单示例