想要使用js文件在iDevice的指定点注入touch或tap



我能够在iDevice中使用.js文件和instrument命令启动ap。Javascript如下:

var target = UIATarget.localTarget();
target.delay(3)
var app = target.frontMostApp()
var win = app.mainWindow()
win.logElementTree();
win.tap();  
target.delay(3) 

使用上面的js我能够在iDevice中启动应用程序,但tap仅位于中心。我如何传递我自己的点或坐标,以便在iDevice中发生点击?

还提供一个链接或书,这将有助于我在进一步的js编写自动化相关的屏幕截图或安装/卸载应用程序等提前感谢!

这是我用来入门的书:http://media.pragprog.com/titles/jptios/find.pdf

如果你想在不同的点上点击窗口,你可以使用tapWithOptions({tapOffset:{x:xCoord, y:yCoord}})函数。然而,这并不是实现应用自动化的最佳方式。

如果你真的想学习,可以看看开发人员文档!https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UsingtheAutomationInstrument/UsingtheAutomationInstrument.html

最新更新