Trying to click the PayPal button from inside an iframe but it's not opening the PayPal sandbox's popup window. Throws the following error:
no such frame: unknown error
The above works on all other browsers except Safari.
I'm using Webdriverio V7 and the following packages in my package.json:
"devDependencies": {
"@types/express": "^4.17.13",
"@types/node": "^18.0.0",
"@wdio/allure-reporter": "^7.19.7",
"@wdio/browserstack-service": "^7.20.9",
"@wdio/cli": "^7.19.7",
"@wdio/local-runner": "^7.19.7",
"@wdio/mocha-framework": "^7.19.7",
"@wdio/selenium-standalone-service": "^7.24.0",
"@wdio/shared-store-service": "^7.20.2",
"@wdio/spec-reporter": "^7.19.7",
"nodemon": "^2.0.18",
"ts-node": "^10.8.0",
"typescript": "^4.7.2"
},
PayPal button click Tests:
public static shouldSwitchToPayPalButtonIframe = async (): Promise<void> => {
it('should switch to paypal button iframe', async () => {
await (await checkoutPaymentPage.payPalButtonIframe).waitForDisplayed({
timeout:20000,
timeoutMsg:"PayPal button iframe didn't appear after 20s"
});
await browser.switchToFrame(await checkoutPaymentPage.payPalButtonIframe);
});
}
public static shouldClickPayPalButton = async (): Promise<void> => {
it('should click PayPal button', async () => {
await (await $(checkoutPaymentPage.payPalIframeDomReadySelector)).waitForExist({
timeout:20000,
timeoutMsg:"PayPal button wasn't yet ready after 20s"
});
await checkoutPaymentPage.clickPayPalButton();
});
}
public static shouldSwitchToPayPalWindow = async (): Promise<void> => {
it('should switch to PayPal window', async () => {
await checkoutPaymentPage.switchToPayPalWindow();
});
}
Function clickPayPalButton() :
public async clickPayPalButton() {
await $(this.payPalButtonSelector).click();
}
The test "should click PayPal button" fails only on Safari and throws
no such frame: unknown error
but surprisingly
await (await $(checkoutPaymentPage.payPalIframeDomReadySelector)).waitForExist()
gets passed, which means the switch to PayPal iframe is working. It is somehow not clicking the button!
Could anyone please help?