common method for Click using Cypress

  Kiến thức lập trình

i have declared elements in page Object class as below

` elements = {
        imageButtonRole: () => cy.get('li[title="Change Role"]', { timeout: tout }).children('img'),
    }`

now i wanted to pass this element to a common method of click() which i wrote in another class like below

`click(element:any, elementName:string)
{
element.click({force:true});
cy.log("Successfully Performed Click on" + element);
}`

but unfortunately this click is throwing error saying element.click() is not a function.
can any one please help me here, Thanks

i have tried as mentioned above

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT