javascript - Cypress 无法识别我试图通过占位符查找的元素

标签 javascript automated-tests cypress

元素:
我如何识别:
cy.get("输入[占位符= What's this article about? ]").type("<3");
错误:
语法错误,无法识别的表达式:input[placeholder=这篇文章是关于什么的?]

最佳答案

尝试这个:

cy.get("input[placeholder=\"What's this article about?\"]").type("<3");
或者使用较少的转义字符:
cy.get('input[placeholder="What\'s this article about?"]').type("<3");

关于javascript - Cypress 无法识别我试图通过占位符查找的元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69462391/

相关文章:

javascript - Gatsby Develop 和 Build 给出不同的结果

javascript - DataTables 将不是列的对象数据添加到行?

angularjs - Protractor 测试: Can someone tell me what I'm doing wrong with Require?

typescript - 如何让 cypress.io 向左滑动 ionic ion-item-sliding?

node-modules - Gitlab CI : how to cache node_modules from a prebuilt image?

javascript - 在地平线上下文中设置 height() 会拉伸(stretch)图形,同时保留覆盖图缩放比例

javascript - 使用 jquery 在事件更改后显示多个图像

testing - 等待元素出现在 TestCafe 中的静态按钮上

automated-tests - 显示测试主体、在 Cypress 中通过测试的测试步骤

cypress - 未找到 "match.text"链接器