我有几行这样的选择查询:
cy.get('#test-container').find('.row')
我想找到一个,在不同的子元素中包含一些文本(例如“测试标题”和“测试值”)。或者至少测试此行是否存在。 像这样:
cy.get('#test-container').find('.row').filter('include.text', 'test title').filter('include.text', 'test value')
最佳答案
使用正确的选择器。
例如:
cy
.get('#test-container')
.find('.row')
.filter(':contains("test title")')
试试这个!
关于javascript - Cypress 通过包含的文本过滤选定的元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52282322/