栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

WebDriverWait无法按预期工作

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

WebDriverWait无法按预期工作

一旦您等待该元素并在尝试调用

click()
方法而不是使用
presence_of_element_located()
method时继续前进,则需要使用
element_to_be_clickable()


以下方法:

try:    myElem = WebDriverWait(self.browser, delay).until(EC.element_to_be_clickable((By.XPATH , xpath)))

更新资料

根据您在评论中的反问题,以下是这三种方法的详细信息:

present_of_element_located

present_of_element_located(locator)的定义如下:

class selenium.webdriver.support.expected_conditions.presence_of_element_located(locator)Parameter : locator - used to find the element returns the WebElement once it is locatedDescription : An expectation for checking that an element is present on the DOM of a page. This does not necessarily mean that the element is visible or interactable (i.e. clickable).

visible_of_element_located

visible_of_element_located(locator)定义如下:

class selenium.webdriver.support.expected_conditions.visibility_of_element_located(locator)Parameter : locator -  used to find the element returns the WebElement once it is located and visibleDescription : An expectation for checking that an element is present on the DOM of a page and visible. Visibility means that the element is not only displayed but also has a height and width that is greater than 0.

element_to_be_clickable

element_to_be_clickable(locator)定义如下:

class selenium.webdriver.support.expected_conditions.element_to_be_clickable(locator)Parameter : locator - used to find the element returns the WebElement once it is visible, enabled and interactable (i.e. clickable).Description : An Expectation for checking an element is visible, enabled and interactable such that you can click it.


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/447780.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号