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

yuv*_*yuv 12 javascript automated-tests cypress

元素:

<input type="text" class="form-control" placeholder="What's this article about?" >
Run Code Online (Sandbox Code Playgroud)

我是如何识别的:

cy.get("input[placeholder=`What's this article about?`]").type("<3");
Run Code Online (Sandbox Code Playgroud)

错误:

语法错误,无法识别的表达式:input[placeholder=What's this article about?]

Zai*_*sta 16

尝试这个:

cy.get("input[placeholder=\"What's this article about?\"]").type("<3");
Run Code Online (Sandbox Code Playgroud)

或者使用较少的转义字符:

cy.get('input[placeholder="What\'s this article about?"]').type("<3");
Run Code Online (Sandbox Code Playgroud)