I am using testcafe version - 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:
The element in the UI I want to detect
chrome dev-tools Elements
for some unknown reason, the hasclass
function keeps failing because the required class cannot be found.
.expect()buttonEssentialplan30Mb.hasClass('.c-form-plan-box--disabled')).ok()
I am using testcafe version - 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:
The element in the UI I want to detect
chrome dev-tools Elements
for some unknown reason, the hasclass
function keeps failing because the required class cannot be found.
.expect()buttonEssentialplan30Mb.hasClass('.c-form-plan-box--disabled')).ok()
-
6
I'm pretty certain that a method called
hasClass
would take a class name parameter, not a class selector. Try omitting the.
prefix. – Bergi Commented Feb 3, 2020 at 10:49 -
tried added the
.
, same issue – teslaTanch Commented Feb 3, 2020 at 11:01 -
3
And I kinda doubt that
.expect()buttonEssentialplan30Mb
is even valid syntax to begin with. Please provide a proper minimal reproducible example of what you are doing. – 04FS Commented Feb 3, 2020 at 12:07
1 Answer
Reset to default 10The correct code for your scenario is
await t.expect(buttonEssentialplan30Mb.hasClass('c-form-plan-box--disabled')).ok()
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744310696a4567931.html
评论列表(0条)