是否可以在iOS中同时自动执行两个应用程序? [英] Is it possible to automate two apps at the same time in iOS?

查看:173
本文介绍了是否可以在iOS中同时自动执行两个应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有这种情况:

在app1中执行脚本,在app1的某些步骤中,app1向我们发送了一个带有URL的SMS,app1需要文本字段中的验证码

Execute the script in app1, in certain step app1 sends us a SMS with a URL, app1 is expecting a validation code in a textfield

我们必须打开SMS应用程序以验证SMS是否存在,该SMS是否具有URL,当我们单击该URL时,它将再次将我们发送到app1,但验证代码会自动写入文本字段中.

We have to open SMS app to verify if SMS exists, this SMS has a URL and when we click on it, it sends us to app1 again but automatically the validation code is written in the textfield.

然后,继续执行脚本.

有可能这样做吗? 我们需要做些什么?

is it possible to do this? what do we need to make it?

谢谢.

推荐答案

对于iOS,您可以启动SMS应用程序,并在该应用程序中执行所需的任何操作.例如,您可以打开SMS应用程序,然后打开最新消息,然后单击(或复制)链接.

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.

我用红宝石.我使用基于XCUITest驱动程序的方法(已经被Noyo链接了) 可以使用的方法如下:

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

将给定字符串复制到iOS设备剪贴板的方法:

Method for copying given string to iOS device clipboard:

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

使用消息"应用程序包ID进行呼叫:

Call using Messages app bundle id:

launch_system_app("com.apple.MobileSMS")
terminate_system_app("com.apple.MobileSMS")

这篇关于是否可以在iOS中同时自动执行两个应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆