I working in an aoutomated test case where I have to delete a few items from the cart but is a kind of special product where if I have to delete them I'm gonna have a modal where is asking me if I want to remove the product, here is a screenshot.
So I create this selector in the pageobjects folder: export const yesRemoveSponsoredProduct = () => $('._2J_WQVWjOaHLaSA4LDlmG1 m0xCx9Ui2ujSd429JXRKK');
And here is the function:
if (await SalePage.yesRemoveSponsoredProduct().isDisplayed() === true) {
await SalePage.yesRemoveSponsoredProduct().waitForClickable();
await SalePage.yesRemoveSponsoredProduct().click();
};
Is an if because if this work is gonna check that there is no special product on the cart and if it this is gonna delete them so the rest of the test can continue.
The issue I'm having is that Is not calling the YES, REMOVE button with that selector and if you check on the devtools the class is there and also If I did document.QuerySelector on the console using that class is gonna call the YES, REMOVE button so I don't know what Im doing wrong, I work with webdriverIO typescript (javascript).
Any tip?