describe('(F<->C) switching', function() {
it("(F<->C) swithing", function() {
cy.visit('https://weather.com')
cy.get('.styles__borderLeft__2zhrE').contains('°C')
cy.get('.styles__button__1Rnmk').first().click()
})
})
这是一个如此简单的代码,但由于某种原因它没有点击按钮。你知道为什么吗?您可以检查此代码,我不明白出了什么问题 Weather.com
最佳答案
使用 .click({force: true }) 强制事件单击
参见https://docs.cypress.io/guides/core-concepts/interacting-with-elements.html#forcing
关于javascript - Cypress 没有点击元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59375097/