Javascript 无法点击UICollectionView单元格

Javascript 无法点击UICollectionView单元格,javascript,ios,uicollectionview,tap,Javascript,Ios,Uicollectionview,Tap,我正在尝试实现UIAutomation脚本,如下所示: var target = UIATarget.localTarget(); var window = target.frontMostApp().mainWindow(); var collectionView = window.collectionViews()[0]; collectionView.cells()[0].tap(); 运行脚本时,我会在日志中看到以下内容: target.frontMostApp().mainW

我正在尝试实现UIAutomation脚本,如下所示:

var target = UIATarget.localTarget();    
var window = target.frontMostApp().mainWindow();
var collectionView = window.collectionViews()[0];
collectionView.cells()[0].tap();
运行脚本时,我会在日志中看到以下内容:

target.frontMostApp().mainWindow().collectionViews()[0].cells()[0].tap()
target.frontMostApp().mainWindow().collectionViews()[0].cells()[0].scrollToVisible()

Script threw an uncaught javascript error: t...cells()[0] could not be tapped

如果我在其他任何一个手机上打这个电话,它会工作,但由于某种原因,第一个手机不会。有人遇到过这个问题吗?

我也遇到过同样的问题。如果使用Instruments->Automation录制新脚本,您将看到它通常执行
.tapWithOptions({tapOffset:{x:0.15,y:0.35}})
,而不是对象
.tap()


我不确定你的显示结构是什么,但我正在测试的应用程序在集合视图的单元格中有集合视图。而
target.frontMostApp().mainWindow().collectionViews()[0].cells()[0].collectionViews()[0].cells()[0]
target.frontMostApp().mainWindow().collectionViews()[0].cells()[0]
target.frontMostApp().mainWindow().collectionViews()[0].cells()[1].collectionViews()[0].tapWithOptions({tapOffset:{x:0.17,y:0.42}})
有效,但我宁愿
.cells()[0]
有效。

谢谢你的回答!会投票但没有代表;)