抱歉,我需要有关通过 cypress.io 查找元素 v-select 和选择选项的帮助.
Sorry,I need help about find element v-select and select option by cypress.io.
<v-select
label="label"
v-model="ccRcode"
ref="ccRcode"
:items="getData"
item-text="descWithCode"
item-value="code"
value="{ ccRcode }"
data-test='test'
></v-select>
既然你使用的是 Vuetify 的 select,那么第一站应该是他们的文档.检查下面的参考资料.
Since you are using Vuetify's select, their documentation should be the first stop. Check the references below.
基本上,他们添加了 data-cy 数据属性,以便于定位元素.所以在你的例子中:
Basically, they add data-cy data attributes to make it easy to target elements. So in your example:
<v-select
label="label"
v-model="ccRcode"
ref="ccRcode"
:items="getData"
item-text="descWithCode"
item-value="code"
value="{ ccRcode }"
data-cy='select-input'
></v-select>
然后在你的测试中:
cy.get('[data-cy=select-input]').select('optionValue')
参考资料:
这篇关于如何使用 vue.js v-select 通过 cypress.io 查找元素并选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
Cypress.io:服务器错误 |404 - 找不到文件或目录Cypress.io: Server Error | 404 - File or director not found(Cypress.io:服务器错误 |404 - 找不到文件或目录)
Testcafe 从元素中获取文本Testcafe get text from element(Testcafe 从元素中获取文本)
如何使用 testcafe 获取表格中所有单元格的文本How do I can get a text of all the cells of the table using testcafe(如何使用 testcafe 获取表格中所有单元格的文本)
检查测试是否在 Jest 的 afterEach 中失败Check if test failed in afterEach of Jest(检查测试是否在 Jest 的 afterEach 中失败)
赛普拉斯获取 href 属性Cypress get href attribute(赛普拉斯获取 href 属性)
如何在父事件上调用子组件的函数How to call function on child component on parent events(如何在父事件上调用子组件的函数)