How to switch context to another app

I am automating iOS native app,
In one test when pressing a button it opens the facebook app however since it is now a different app the iOS driver can’t interact with the elements.
Can some one help in code sample how to switch context to another native app & back to the origin native app?

correction for the early post,
I am running on native & pressing a button opens the safari browser.
At that point i need to press a button in the opened site.
Can someone explain what is the best practice that will allow switch to the safari view & interact with the elements?
Thanks in advance folks…

1 Like

according to @jonahss its not possible:

But the fact is that I get out of my app, send email with the native app, change settings, etc… all withing the same appium session in a real device :expressionless: never used webview tho

Thanks for the reply T,
So lets say i want to launch the safari on the iPhone & open it on a certain URL?
can you assist on achieving it? (so far i worked on iOS native & have no experience on safari)

I also need help in this. I need to open my app, switch to safari, open URL and do something there. Again switch back to my app and continue automation.
Any idea how to do this ?

FYI: I just updated iphone to ios8 and I cannot control anything out of my application. I can still tap, press, swipe, etc. but cannot see any element, so cannot input text, read, etc… :frowning:

So on ios8 dont think you will be able to do that!