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

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

问题描述

我们有这样的场景:

在 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

我们必须打开短信应用来验证短信是否存在,这条短信有一个 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 应用程序并在应用程序中执行任何您喜欢的操作.例如,您可以打开短信应用,然后打开最新消息,然后单击(或复制)链接.

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天全站免登陆