gpt4 book ai didi

cypress - 元素不可见,因为它具有 CSS 属性 : 'position: fixed' and its being covered by another element

转载 作者:行者123 更新时间:2023-12-04 12:06:05 27 4
gpt4 key购买 nike

有人可以帮我解决这个 Cypress 错误吗?

Cypress Error: Timed out retrying: expected '<div.sub-categories-list>' to be '0 visible'

This element '<div.sub-categories-list>' is not visible because it has CSS property: 'position: fixed' and its being covered by another element:

undefined

最佳答案

您断言的元素在视口(viewport)中不可见,可能必须滚动到才能可见。

Cypress 在测试运行期间不会自动滚动到元素,但您可以使用 scrollIntoView() ,所以这样写你的断言:

cy.get('#yourElement')
.scrollIntoView()
.should('be.visible')

关于cypress - 元素不可见,因为它具有 CSS 属性 : 'position: fixed' and its being covered by another element,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57832595/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com