处理柏树中的多个阴影元素
Handling multiple shadow element in cypress
我正在尝试自动化具有多个阴影元素的屏幕。例如,我必须为名为 'Student Name' 的文本字段设置数据。该字段要遍历多个shadow元素
cy.get('app-screen)
.shadow()
.find('app-toolbar')
.shadow()
.find('student-container')
.shadow()
.find('input[id="studentName"]')
.type("Viola");
有没有我可以像这样指定的替代方案:
cy.get('app-screen app-toolbar student-container input[id="studentName"]').type('Viola');
我为量角器找到了类似的解决方案。是否有适用于赛普拉斯的解决方案,例如添加客户定位器?
谢谢
去cypress.json
写。这可确保您所有的 get 和 find 查询都自动通过影子 dom 而无需明确提及。
includeShadowDom: true
然后在你的测试中写:
cy.get('app-screen).find('input[id="studentName"]').type("Viola")
我正在尝试自动化具有多个阴影元素的屏幕。例如,我必须为名为 'Student Name' 的文本字段设置数据。该字段要遍历多个shadow元素
cy.get('app-screen)
.shadow()
.find('app-toolbar')
.shadow()
.find('student-container')
.shadow()
.find('input[id="studentName"]')
.type("Viola");
有没有我可以像这样指定的替代方案:
cy.get('app-screen app-toolbar student-container input[id="studentName"]').type('Viola');
我为量角器找到了类似的解决方案。是否有适用于赛普拉斯的解决方案,例如添加客户定位器?
谢谢
去cypress.json
写。这可确保您所有的 get 和 find 查询都自动通过影子 dom 而无需明确提及。
includeShadowDom: true
然后在你的测试中写:
cy.get('app-screen).find('input[id="studentName"]').type("Viola")