善用python中的try except
来源:互联网 发布:西工大矩阵论课件 编辑:程序博客网 时间:2024/06/05 06:42
校验某元素当前是可见的,一般的写法为
#找到id 为dropdown1的父元素WebDriverWait(dr, 10).until(lambda the_driver:the_driver.find_element_by_id('dropdown1').is_displayed())但是 校验某元素不可见的时候,就不太好用了 ,此时可以利用try except来进行判断
try: <pre name="code" class="python"> WebDriverWait(dr, 10).until(lambda the_driver:the_driver.find_element_by_id('dropdown1').is_displayed()) aa=1except: aa=2if aa==1: "元素还是可见的"else: "元素是不可见的"
另外可以用元素的属性判断
具体的关键字为hasAttribute ,大家可以参考下.
0 0
- 善用python中的try except
- Python中的try...except...finally
- python中的try/except/else/finally语句
- python中的try/except/else/finally语句
- python中的try/except/else/finally语句
- python中的try/except/else/finally语句
- python中的异常处理 try..except
- python中的try/except/else/finally语句
- python中的try/except/else/finally语句
- python中的try/except/else/finally语句
- python中的try/except/else/finally语句
- python try/except/finally
- python try/except/finally
- python try/except/finally
- python try/except/finally
- python try/except/finally
- python try/except/finally
- python try/except/finally
- 关与class和interface的几个语法问题
- linux的基本操作2
- MVC4. Raxor 引入类的命名空间
- UITextInputTraits
- spring mvc+ajaxfileupload 实现异步上传图片
- 善用python中的try except
- Spring官网下载Spring源码
- IntelliJ IDEA中怎么恢复本地代码
- ORA-01810 格式代码出现两次,日期格式,时间格式,to_date错误
- 视觉/视频相关的一些基础知识
- Hibernate Configuration 之连接数据库
- Android反编译(下)
- 解决报错:Session为空(未将对象引用设置到对象的实例)
- 根据字体多少使UILabel自动调节尺寸