Is it possible to automate two apps at the same time in iOS?

巧了我就是萌 提交于 2019-12-06 10:25:42

Yes, As per your scenario you have to launch the messages(call it as app2) application in the middle of execution of script in app1. You can open the app2 by using below code.

 driver.startActivity(app2PackageName, app2ActivityName);

Now app2 will be opened you can click on the link in app2 which will open app1 and you can access the elements in app1.

According to this article, it's possible if you're using Appium's XCUITest driver.

Please note it only supports iOS versions 9.3 and above.

You can find a few other application management commands that might interest you at the official docs.

For iOS you can bring up the SMS app and do whatever you like within the app. For example, you could open SMS app, then open the latest message and then click (or copy) the link.

I use ruby. I use methods based on XCUITest driver (that Noyo linked already) Methods that can be used are the following:

Method for launching any app installed on device:

def launch_system_app(bundle_id)
  @driver.execute_script('mobile: launchApp',
     {'bundleId': "#{bundle_id}"}
   );
end

Method for terminating the launched app:

def terminate_system_app(bundle_id)
  @driver.execute_script('mobile: terminateApp',
     {'bundleId': "#{bundle_id}"}
   );
end

Method for copying given string to iOS device clipboard:

def set_pasteboard(content)
  @driver.set_clipboard(content: content)
end

Call using Messages app bundle id:

launch_system_app("com.apple.MobileSMS")
terminate_system_app("com.apple.MobileSMS")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!