设置应用程序,iPhone自动化 [英] Automation of Settings app, iPhone

查看:499
本文介绍了设置应用程序,iPhone自动化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone上尝试UI自动化连接到任何给定的Wi-Fi网络。我要自动设置应用。它应该自动:


  1. 开启设置应用;

  2. 打开无线网络连接;

  3. 通过提供连接到特定网络的 SSID WPA

我的问题是:


  1. 是否有可能使用自动化UI自动化的内置应用程序?难道苹果/ iOS的安全模型$ P ​​$ pclude任何此类访问内置的应用程序?

  2. 如果有可能,如何实现这一目标?


解决方案

我知道我迟到了,但我想提供一个更完整的答案,并阐述我的解决方案。

我从shell脚本运行我uiautomation,这里是我的解决方案。

(你必须删除空格等)

settingsapp.sh

 #!/斌/庆典
睡眠5秒
仪器-v -w MY_SIMULATOR_DEVICE_ID -t
/Applications/X$c$c.app/Contents/Applications/Instruments.app/Contents/
插件/ AutomationInstrument.xrplugin /内容/资源/
Automation.tracetemplate /Applications/X$c$c.app/Contents/Developer/
平台/ iPhoneSimulator.platform /开发商/软件开发工具包/ iPhoneSimulator.sdk /
应用程序/ preferences.app -e UIASCRIPT
/用户/路径,我的js文件/ settingapp.js

settingapp.js

  VAR的目标= UIATarget.localTarget();
target.delay(1.0);
target.frontMostApp()。的主窗口()。tableViews()[0] .cells()
  [常规]点击()。target.delay(1.0);
target.frontMostApp()。的主窗口()。tableViews()[0] .cells()
  [语言和放大器;地区]。点击();target.delay(1.0);
target.frontMostApp()。的主窗口()。tableViews()[0] .cells()
  [地区]点击()。target.delay(1.0);
target.frontMostApp()。的主窗口()。tableViews()[0] .cells()
  [英国]点击()。target.delay(1.0);

所以,你可以有几个shell脚本,首先一个设置语言,然后又做截屏,然后再次运行切换到另一种语言等。

:)

I am trying UI Automation on iPhone for connecting to any given Wi-Fi network. I want to automate Settings app. It should automatically:

  1. open Settings app;
  2. turn on Wi-Fi;
  3. connect to given network by providing SSID and WPA.

My questions are:

  1. Is it possible to automate any inbuilt app using UI Automation? Does the Apple/iOS security model preclude any such access to inbuilt apps?
  2. If it is possible, how to achieve this?

解决方案

I know I'm late to the party, but I'd like to provide a more complete answer and elaborate on my solution.

I run my uiautomation from shell scripts, here's my solution..

(You'll have to remove spaces etc)

settingsapp.sh

#!/bin/bash
sleep 5s
instruments -v -w MY_SIMULATOR_DEVICE_ID -t
/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/
PlugIns/AutomationInstrument.xrplugin/Contents/Resources/
Automation.tracetemplate /Applications/Xcode.app/Contents/Developer/
Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/
Applications/Preferences.app -e UIASCRIPT 
/Users/ path to my js file/settingapp.js

settingapp.js

var target = UIATarget.localTarget();
target.delay(1.0);
target.frontMostApp().mainWindow().tableViews()[0].cells()
  ["General"].tap();

target.delay(1.0);
target.frontMostApp().mainWindow().tableViews()[0].cells()
  ["Language & Region"].tap();

target.delay(1.0);
target.frontMostApp().mainWindow().tableViews()[0].cells()
  ["Region"].tap();

target.delay(1.0);
target.frontMostApp().mainWindow().tableViews()[0].cells()
  ["United Kingdom"].tap();

target.delay(1.0);

So you could have several shell scripts, firstly one to set the language, then another to do screen shots, then run another switch to another language etc..

:)

这篇关于设置应用程序,iPhone自动化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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