javascript - 使用 Cypress 无法在 Web 应用程序上单击开始按钮
问题描述
学习 Cypress,在 Google 上找不到答案。这是按钮和周围元素的 html。我相信这个页面是一个带有 flex css 的 vue.js 网络应用程序。
<div class="row no-gutters align-center justify-center" data-v-11111111="">
<div class="v-card__actions" data-v-11111111="">
<button class="title v-btn--contained theme--dark v-size--x-large green" data-v-11111111="" type="button">
<span class="v-btn__content">
Start
</span>
</button>
</div>
</div>
这是我的赛普拉斯描述的:
describe('Begin the form', () => {
it('I can start the form', () => {
cy.visit('https://this.app.com/#/start');
cy.get("span[class='.v-btn__content']").click();
});
});
当我在 Cypress 中运行上述内容时,我在 Cypress 结果中得到以下结果:
Timed out retrying: Expected to find element: span[class='.v-btn__content'], but never found it.
解决方案
好的,然后试试这个
cy.get('.v-btn--contained').click();
推荐阅读
- javascript - 剪贴板 API 在点击事件中与 Axios 配合使用
- javascript - Invariant Violation Invalid hook call / cross-origin error
- java - for (;;) 循环有什么作用?
- android - Google ML Kit Text Recognition(v16.1.3) 升级依赖后崩溃
- c - 释放 char 指针数组 - 仅当我有偶数个字符串时才有效......?
- windows-installer - 在重大升级期间,如何在 InstallScript 中找到应用程序的先前安装位置?
- javascript - 试图将文本文件加载到
标签,为什么它不起作用?
- pandas - 如何在matplotlib中绘制像A *这样的分级字母
- python - 将数据框中的 NaN 值替换为基于其他列的相应值
- arrays - 如何在 C 中正确平均这些数字?