使用UI Automation以编程方式打开/关闭真实iOS设备上的wifi [英] Programmatically turn on/off wifi on real iOS device with UI Automation

查看:147
本文介绍了使用UI Automation以编程方式打开/关闭真实iOS设备上的wifi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了一次或两次打开/关闭真实iOS设备上的wifi(在我的情况下是iPad),并且UI自动化脚本似乎不可能。

I have already read once or twice that turn on/off wifi on a real iOS device (iPad in my case) with a UI Automation script seems not possible.

我还读到你可以使用目标设置创建一个脚本,但它似乎只适用于模拟器,我是对的吗?

I've also read that you can create a script with the target "Settings" but it seems that it's only for simulators, am I right ?

你有没有我的想法或解决方案?

Do you have any ideas or solutions for me ?

问候,

推荐答案

我是能够这样做(只需确保目标应用程序处于最重要的状态):

i was able to do so (just make sure you target application is on foremost state when doing so):

var target = UIATarget.localTarget();

target.dragFromToForDuration({x:0.1, y:557.00}, {x:211.00, y:206.00},
0.5); //to expose the actions panel on iOS

target.frontMostApp().mainWindow().elements()["Wifi"].tapWithOptions({tapOffset:{x:0.44, y:0.47}});

这篇关于使用UI Automation以编程方式打开/关闭真实iOS设备上的wifi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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