Getting Blocked a frame with origin "<HostURL>" from accessing a cross-origin frame. Protocols, domains, and ports must match

Hello,

I am running my script on Safari browser on iPhone 13 pro device. I am using BrowserStack cloud platform for running my scripts.

I am getting following error while switching to a frame which contents input boxes for entering credit card details. iFrame src contains url for stripe payment site.

WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Blocked a frame with origin “” from accessing a cross-origin frame. Protocols, domains, and ports must match.

Stacktrace:
UnknownError: An unknown server-side error occurred while processing the command. Original error: Blocked a frame with origin “” from accessing a cross-origin frame. Protocols, domains, and ports must match.
at errorFromMJSONWPStatusCode (/nix/store/5hlpmsgwcjy80y53pl35cqhrjkw7rnsq-appium-1.21.0/node_modules/appium-base-driver/lib/protocol/errors.js:767:10)
at convertResult (/nix/store/5hlpmsgwcjy80y53pl35cqhrjkw7rnsq-appium-1.21.0/node_modules/appium-xcuitest-driver/node_modules/appium-remote-debugger/lib/utils.js:222:11)
at RemoteDebuggerRealDevice.execute (/nix/store/5hlpmsgwcjy80y53pl35cqhrjkw7rnsq-appium-1.21.0/node_modules/appium-xcuitest-driver/node_modules/appium-remote-debugger/lib/mixins/execute.js:135:10)
at RemoteDebuggerRealDevice.executeAtom (/nix/store/5hlpmsgwcjy80y53pl35cqhrjkw7rnsq-appium-1.21.0/node_modules/appium-xcuitest-driver/node_modules/appium-remote-debugger/lib/mixins/execute.js:27:17)

Is there any solution or workaround to this problem?

I would try this: Get the url of the iframe, open a new browser window with the url of the iframe. However, i think this might end up causing different kind of errors since the url is payment processing site and they can intentionally block any “automation” ..

I asked chatgpt about this even it stated this:

if it’s a 3rd party widget (Stripe, PayPal, captcha): you may not be able to automate it on iOS Safari

If you are testing your own website with stripe integration, i would assume stripe can provide a test environment where the payments can be tested. Also, again, if you are testing and not trying to do some botting, you could ask the devs to add `sandbox=“allow-scripts allow-same-origin”` for the iframe tag that loads stripe .. It might help.

1 Like