JDpan
JDpan

Reputation: 1

Checkbox on gridcell is not checkable using playwright Ts

I need to assert the status of this checkbox (as checked/unchecked) (arrowed in picture).

checkbox in grid cell

Code (in rectangle) is reproduced below:

<div column="0" class="webix_column  webix_first webix_select_mark" style="" xpath="1">
   <div role="gridcell" aria-rowindex="1" aria-colindex="1" class="webix_cell" style="" tabindex="0">
       <span class="webix_table_checkbox webix_icon wxi-checkbox-marked">
       </span>
   </div>
</div>

To check the status, I asserted thus:

const mapBox = page.locator("//span[@class='webix_table_checkbox webix_icon wxi-checkbox-marked']").nth(0);
await mapBox.isChecked();
//OR 
// await expect(mapBox).toBeChecked();

...but either way, I got thrown:

Error: locator.isChecked: Error: Not a checkbox or radio button
Call log:
  - waiting for locator('//span[@class=\'webix_table_checkbox webix_icon wxi-checkbox-marked\']').first()

It turns out the selector is an {object} type as:

console.log("Map box: ", typeof mapBox);

...gives:

Map box: object

For sure, there is a way to ascertain the checkbox's status, I just need someone to point it out. Thank you.

Upvotes: 0

Views: 37

Answers (0)

Related Questions