当前位置:网站首页>Selenium 显示等待WebDriverWait
Selenium 显示等待WebDriverWait
2022-04-23 20:43:00 【weixin_52539672】
常规用法
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class HomePage:
exists_link = (By.XPATH, '/html/body/div[2]/div/div[2]/div[1]/span')
def __init__(self, driver: WebDriver):
self.driver = driver
def get_element_exists(self):
try:
WebDriverWait(self.driver, 10).until(EC.visibility_of_element_located(self.exists_link))
except:
return False
else:
return True
2、等待条件及其含义
| 等待条件 | 含义 |
|---|---|
|
title_is
|
标题是某内容
|
|
title_contains
|
标题包含某内容
|
|
presence_of_element_located
|
节点加载出,传入定位元组,如
(By.ID, 'p')
|
|
visibility_of_element_located
|
节点可见,传入定位元组
|
|
visibility_of
|
可见,传入节点对象
|
|
presence_of_all_elements_located
|
所有节点加载出
|
|
text_to_be_present_in_element
|
某个节点文本包含某文字
|
|
text_to_be_present_in_element_value
|
某个节点值包含某文字
|
|
frame_to_be_available_and_switch_to_it frame
|
加载并切换
|
|
invisibility_of_element_located
|
节点不可见
|
|
element_to_be_clickable
|
节点可点击
|
|
staleness_of
|
判断一个节点是否仍在
DOM,可判断页面是否已经刷新
|
|
element_to_be_selected
|
节点可选择,传节点对象
|
|
element_located_to_be_selected
|
节点可选择,传入定位元组
|
|
element_selection_state_to_be
|
传入节点对象以及状态,相等返回
True,否则返回
False
|
|
element_located_selection_state_to_be
|
传入定位元组以及状态,相等返回
True,否则返回
False
|
|
alert_is_present
|
是否出现
Alert
|
版权声明
本文为[weixin_52539672]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_52539672/article/details/124291329
边栏推荐
- 一些接地气的话儿
- 启牛学堂有用吗,推荐的证券账户是否安全
- Leetcode 1337. Row K with the weakest combat effectiveness in the matrix
- Use of node template engine
- 打新债中签以后怎么办,网上开户安全吗
- [matlab 2016 use mex command to find editor visual studio 2019]
- Go zero framework database avoidance Guide
- Fastdfs思维导图
- Elastic box model
- 高薪程序员&面试题精讲系列91之Limit 20000加载很慢怎么解决?如何定位慢SQL?
猜你喜欢

On IRP from the perspective of source code

內網滲透之DOS命令

浅谈数据库设计之三大范式

How can matlab obtain the truncated image in trainingimagelabeler

A login and exit component based on token

Syntax Error: TypeError: this. getOptions is not a function

Case of the third day of go language development fresh every day project - news release system II

Recognition of high-speed road signs by Matlab using alexnet

2022dasctf APR x fat epidemic prevention challenge crypto easy_ real

中创存储|想要一个好用的分布式存储云盘,到底该怎么选
随机推荐
学会打字后的思考
A login and exit component based on token
Leetcode 542, 01 matrix
上海回應“面粉官網是非法網站”:疏於運維被“黑”,警方已立案
Parsing methods of JSON data in C - jar and jobobject: error reading jar from jsonreader Current JsonReader item
[PTA] l2-011 play with binary tree
On BIM data redundancy theory
Vulnhub DC: 1 penetration notes
[PTA] l1-002 printing hourglass
Plato farm is one of the four largest online IEOS in metauniverse, and the transaction on the chain is quite high
MySQL数据库常识之储存引擎
LeetCode 116. 填充每个节点的下一个右侧节点指针
Unity animation creates sequence frame code and generates animationclip
I JS deep copy and shallow copy
vulnhub DC:1渗透笔记
Matlab: psychtoolbox installation
[PTA] get rid of singles
Easy to use nprogress progress bar
Psychological formula for converting RGB to gray value
浅谈数据库设计之三大范式