Unable to switch to iFrame in IOS Hybrid app

I am trying to switch context to iframe to automate a login frame in a hybrid app I am automating. All the other web elements are being identified, but while I try to switch context to this iframe, its throwing the following error

An unknown server-side error occurred while processing the command. Original error: Error while executing atom: Blocked a frame with origin “https://m.mytestapp.com” from accessing a frame with origin “https://www.mytestapp.com”. Protocols, domains, and ports must match. (status: 18) (WARNING: The server did not provide any stacktrace information).

Code used : driver.switchTo().frame(nameofIframe);

I have been stuck with this for quite a while , not being able to proceed with automation on Ios as if the login screen doesnt work, I wouldnt be able to navigate further . Kindly help

ios 11.2
appium 1.7.2
xcode 9.2

Hi, can someone please provide some info ? I have been searching for a solution since three days now, any help would be much appreciated . Tagging a few names that I remember @Venkatesh_Akula @Telmo_Cardoso

This link might help.

Check out https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/cross-domain-iframes.md, maybe that will help.

Thanks @Gunjan_Gupta , I did see that, but unfortunately, the web wrapped up in the native app is pointed to the live environment and hence the dev’s wouldnt do that change

solution that worked is to get the url using driver.get(url) and then do the actions as normal

Hi @PoornimaSuraj

I had same issue like you on iOS 12.3 version on real device.
How did you get this worked ? please let me know.

Thanks
SK

Hi,

I am facing the same issue, unable to switch iframe in iOS.
Browser: Safari

Getting the below error in simulator:
An unknown server-side error occurred while processing the command. Original error: Blocked a frame with origin from accessing a cross-origin frame.

Please share if there is any workaround for the issue to handle the frame switching in iOS in Appium. However, It is working in case of Emulator.

Thanks