简体   繁体   English

裂片等待element.visible

[英]Splinter wait for element.visible

I have some anoying behaviour with splinter. 我有一些刺痛的行为。 I do 我做

button.click()
assert not button.visible  # Fails

Then I do 那我做

button.click()
time.sleep(1)
assert not button.visible  # Succeeds

That is pretty bad... Is this intended behaviour? 真是太糟糕了……这是预期的行为吗? Everything else seems to poll and wait for a bit before it fails. 其他所有内容似乎都经过轮询,等待一会儿才失败。

I am not sure how Splinter works internally, but looks like you are using an attribute access and it might be cached. 我不确定Splinter在内部如何工作,但看起来您正在使用属性访问,并且可能已对其进行了缓存。 Have you tried: 你有没有尝试过:

 assert not browser.is_element_visible_by_css("#my-button-id")

is_element_visible_by_css has always an implicit wait you can configure in Splinter settings. is_element_visible_by_css始终具有隐式等待,您可以在Splinter设置中进行配置。 Please note that with browser (Selenium) testing everything has implicit waits, as browser DOM operations happen asynchronously and there is no backchannel to get information when some element becomes visible or when it disappears. 请注意,使用浏览器(Selenium)测试时,所有内容都有隐式等待,因为浏览器DOM操作是异步进行的,并且当某些元素变为可见或消失时,没有反向通道来获取信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM