小编yuv*_*yuv的帖子

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?]

javascript automated-tests cypress

12
推荐指数
1
解决办法
2万
查看次数

调用 text/aria-label 给出对象而不是文本

我试图从元素调用文本/aria-标签,但我得到一个对象:

元素:

<p class="styles_startingColumn__8EIiq" data-cy="listValues_popup_txt" aria-label="1+" data-mui-internal-clone-element="true">1+</p>
Run Code Online (Sandbox Code Playgroud)

代码 :

getFirstValueInList() {
        return cy.get("[data-cy='listValues_popup_txt']").should('be.visible').eq(0).invoke('attr','aria-label');
}


 getFirstValueInList() {
        return cy.get("[data-cy='listValues_popup_txt']").should('be.visible').eq(0).invoke('text');
}
Run Code Online (Sandbox Code Playgroud)

element cypress

0
推荐指数
1
解决办法
321
查看次数

标签 统计

cypress ×2

automated-tests ×1

element ×1

javascript ×1