我们有这样的场景:
在 app1 中执行脚本,在特定步骤中,app1 向我们发送了一 strip 有 URL 的短信,app1 需要文本字段中的验证码
我们必须打开 SMS 应用程序来验证 SMS 是否存在,这条 SMS 有一个 URL,当我们点击它时,它会再次将我们发送到 app1,但验证码会自动写入文本字段。
然后,继续脚本。
这有可能吗? 我们需要什么才能做到这一点?
谢谢。
最佳答案
对于 iOS,您可以打开 SMS 应用程序并在该应用程序中执行任何您喜欢的操作。例如,您可以打开短信应用程序,然后打开最新消息,然后单击(或复制)链接。
我用 ruby 。我使用基于 XCUITest 驱动程序的方法(Noyo 已经链接) 可以使用的方法如下:
启动设备上安装的任何应用程序的方法:
def launch_system_app(bundle_id)
@driver.execute_script('mobile: launchApp', {'bundleId': "#{bundle_id}"});
end
终止启动的应用程序的方法:
def terminate_system_app(bundle_id)
@driver.execute_script('mobile: terminateApp', {'bundleId': "#{bundle_id}"});
end
将给定字符串复制到 iOS 设备剪贴板的方法:
def set_pasteboard(content)
@driver.set_clipboard(content: content)
end
使用“信息”app bundle id 调用:
launch_system_app("com.apple.MobileSMS")
terminate_system_app("com.apple.MobileSMS")
关于ios - 是否可以在 iOS 中同时自动化两个应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43126999/