element_to_be_clickable(locator)
是等待页面元素可见的时候操作,会设置一定范围的时间,如果在时间范围内,元素可见,就
执行操作,元素不可见,就会引发TimeoutException的异常。如下是element_to_be_clickable
类的源码
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
driver = webdriver.Firefox()
driver.implicitly_wait(30)
driver.get('http://www.baidu.com')
so = WebDriverWait(driver,10).until(expected_conditions.element_to_be_clickable((By.ID,'kwkw')))
so.send_keys('appium')
driver.quit()
element_to_be_clickable(locator)的更多相关文章
- <译>Selenium Python Bindings 6 - WebDriver API
本章涉及Selenium WebDriver的所有接口. Recommended Import Style 推荐的导入风格如下: from selenium import webdriver 然后,你 ...
- python+selenium自动化软件测试(第4章):场景判断与封装
4.1 显示等待WebDriverWait 前言:在脚本中加入太多的sleep后会影响脚本的执行速度,虽然implicitly_wait()这种隐式等待在一定程度上节省了很多时间.但是一旦页面上某些j ...
- python selenium基于显示等待封装的一些常用方法
import os import time from PIL import Image from selenium import webdriver from appium import webdri ...
- Python+Selenium笔记(十):元素等待机制
(一) 前言 突然的资源受限或网络延迟,可能导致找不到目标元素,这时测试报告会显示测试失败.这时需要一种延时机制,来使脚本的运行速度与程序的响应速度相匹配,WebDriver为这种情况提供了隐式等待 ...
- webdriver API study
This chapter cover all the interfaces of Selenium WebDriver. Recommended Import Style The API defini ...
- webdriver常用API
本章涉及Selenium WebDriver的所有接口. Recommended Import Style 推荐的导入风格如下: from selenium import webdriver 然后,你 ...
- selenium自动化之显式等待和EC(expected_conditions)模块
很多人都有这种经历,selenium脚本当前运行没问题,过了一段时间再运行就报错了,然后过几天又好了.其中的原因估计60%的人都知道,是因为元素加载这块有问题.通常的解决方案就是加上sleep或者隐式 ...
- webDriver API——第15部分Expected conditions Support
class selenium.webdriver.support.expected_conditions.alert_is_present Bases: object Expect an alert ...
- 爬虫系列(十二) selenium的基本使用
一.selenium 简介 随着网络技术的发展,目前大部分网站都采用动态加载技术,常见的有 JavaScript 动态渲染和 Ajax 动态加载 对于爬取这些网站,一般有两种思路: 分析 Ajax 请 ...
随机推荐
- Linux中配置jdk环境变量出错:bad ELF interpreter: No such file or directory解决方法
yum install glibc.i686 重新安装,javac成功 如果还有如下类系错误 再继续安装包 error while loading shared libraries: libstdc+ ...
- java8 新特性,stream的应用
https://www.cnblogs.com/fengli9998/p/9002377.html http://www.runoob.com/java/java8-optional-class.ht ...
- Linux 安装Samba服务器
1. 服务器 安装软件: yum -y install samba 创建共享目录并更改目录权限: mkdir -p /home/lee/samba chmod -R 0777 /home/lee/sa ...
- Hibernate基本原理理解
什么是Hibernate? Hibernate,翻译过来是冬眠的意思,正好现在已经进入秋季,世间万物开始准备冬眠了.其实对于对象来说就是持久化. 扫盲------------------------- ...
- 导入Excel扩展名是.xls 和.xlsx的
1.首先是导入Excel2003以前(包括2003)的版本,扩展名是.xls 的 /** * 操作Excel2003以前(包括2003)的版本,扩展名是.xls * @param templetFil ...
- springboot使用外部application.properties配置文件
一.背景介绍 springboot默认的application.properties文件只能在项目内部,如果打成docker镜像后配置文件也打进去了,这样每次需要改动配置(比如数据库的连接信息)就需要 ...
- 《转》从系统和代码实现角度解析TensorFlow的内部实现原理 | 深度
from https://www.leiphone.com/news/201702/n0uj58iHaNpW9RJG.html?viewType=weixin 摘要 2015年11月9日,Google ...
- 【shell】sed处理多行合并
有这么一个题 文件格式 table=t1 name owner address table=t2 id text col1 comment col5 table=t3 prod_name price ...
- Python简单雷达图绘制
import numpy as npimport matplotlib.pyplot as pltimport matplotlibmatplotlib.rcParams['font.family'] ...
- Java的格式化输出
在java中除了有System.out.println();和System.out.print();之外还有一种格式化的输出,用来限制宽度,保留小数点后的位数,还有对齐方式. 代码: package ...