对Selenium WebDriver的增强,用于超时等。
selenious的Python项目详细描述
硒
。。图片::https://img.shields.io/pypi/v/selenious.svg :目标:https://pypi.python.org/pypi/selenious
。。图片::https://img.shields.io/pypi/dm/selenious.svg :目标:https://pypi.python.org/pypi/selenious
。。图片::https://github.com/bonafideduck/selenious/workflows/Sanity/badge.svg :目标:https://github.com/bonafideduck/selenious/actions?query=branch%3Amaster+workflow%3A%22Sanity%22
。。图片::https://readthedocs.org/projects/selenious/badge/?version=latest :目标:https://selenious.readthedocs.io/en/latest/?badge=latest :alt:文档状态
允许对分层数据结构(如JSON)进行深度提取的库。在
- 自由软件:BSD许可证
- 文档:https://selenious.readthedocs.io。在
简介
Selenious增强了Selenium WebDriver find_element*
函数,使其具有
timeout
,debounce
,poll_frequency
,recover
,对于find_elements*
,
一个min
计数。在
硒已经有一个implicitly_wait
和一个WebDriverWait
函数。
这些都没有硒化物添加的多功能性和自然感
符合规范。为了给一个调用增加5秒的超时,Selenious会
比利时:
driver.find_element_by_id('popup', timeout=5)
使用implicitly_wait
时,代码将是
并且WebDriverWait
将是
WebDriverWait(driver, 5).until(
EC.presence_of_element_located((By.ID, "popup"))
)
特点
find_元素功能的增强
- 在
在timeout
-等待成功查找的最长时间(秒)。在 - 在
在poll_frequency
-为元素轮询驱动程序的频率 - 在
在debounce
-对于find_elements*
请等待此时间段,以便计数不变。在 - 在
在min
-对于find_elements*
要查找的最小计数。在 - 在
在recover
-如果找不到项或最小项,请定期调用此项并重试。在
selenium webdriver的直接替代品
而不是from selenium.webdriver import Chrome
一种方便
可以使用from selenious.webdriver import Chrome
的
为您导入SeleniousMixin
。在
设置可以在函数中设置,也可以全局设置
本地,webdriver.find_element_by_id('id', timeout=5)
,或全局,
webdriver.timeout = 5
。在
学分
这个包是用Cookiecutter和audreyr/cookiecutter-pypackage
}项目模板创建的。在
。。_厨师长:https://github.com/audreyr/cookiecutter
.. _audreyr/cookiecutter-pypackage
:https://github.com/audreyr/cookiecutter-pypackage
历史
0.1.0(2020年10月11日)
- PyPI的第一个版本。在
- 项目
标签: