简体   繁体   English

hasclass 不适用于 testcafe CSS 选择器

[英]hasclass doesn't work with testcafe CSS selectors

I am using testcafe version - 1.6.1我正在使用 testcafe 版本 - 1.6.1

I am trying to apply an assertion to see if an element is clickable or not (expect to not be clickable).我正在尝试应用断言来查看元素是否可点击(预计不可点击)。

I've found the elements class name and a dynamic sibling class which appears to not be clickable in the browser element.我找到了元素类名和一个动态同级类,它在浏览器元素中似乎不可点击。

I've attached two snapshots below of the actual UI element and its DOM:我在下面附上了实际 UI 元素及其 DOM 的两个快照:

for some unknown reason, the hasclass function keeps failing because the required class cannot be found.由于某些未知原因, hasclass函数不断失败,因为找不到所需的类。

.expect()buttonEssentialplan30Mb.hasClass('.c-form-plan-box--disabled')).ok()

您的场景的正确代码是

await t.expect(buttonEssentialplan30Mb.hasClass('c-form-plan-box--disabled')).ok()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM