最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to use Cypress to assert that a HTML element has a height or width greater than a specified amount? - Stack Ove

programmeradmin8浏览0评论

This Github thread highlights how to use Cypress to assert an element has a specified height.

cy.get(mainMenu).should('have.css', 'height', '55px')

How do I use Cypress to assert an element is greater than a specified height?

For example, I want to assert that a certain HTML element always has a height greater than 100px.

This Github thread highlights how to use Cypress to assert an element has a specified height.

cy.get(mainMenu).should('have.css', 'height', '55px')

How do I use Cypress to assert an element is greater than a specified height?

For example, I want to assert that a certain HTML element always has a height greater than 100px.

Share Improve this question asked Oct 27, 2019 at 2:01 ptkptk 7,66317 gold badges53 silver badges106 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 11
cy.get(mainMenu).invoke('height').should('gte', 55)

invoke() - to call a jquery function on an element which is the height.

gte (aka. least) - to assert the target is equal or greater than a given value

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论