Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法在ipad应用程序中点击图像_Javascript_Ios_Ios Ui Automation_Xcode Instruments - Fatal编程技术网

Javascript 无法在ipad应用程序中点击图像

Javascript 无法在ipad应用程序中点击图像,javascript,ios,ios-ui-automation,xcode-instruments,Javascript,Ios,Ios Ui Automation,Xcode Instruments,我在应用程序中有此图像。我想模拟在图像上点击。图像位置如下所示: target.frontMostApp().mainWindow().images()[“patch blue right.png”].images()[4]。 我的javascript代码如下所示: target.frontMostApp().main窗口().images()[“patch blue right.png”].images()[4].tap() 但运行代码后,将显示以下错误消息: 错误:target.frontM

我在应用程序中有此图像。我想模拟在图像上点击。图像位置如下所示:

target.frontMostApp().mainWindow().images()[“patch blue right.png”].images()[4]。

我的javascript代码如下所示:

target.frontMostApp().main窗口().images()[“patch blue right.png”].images()[4].tap()

但运行代码后,将显示以下错误消息:

错误:target.frontMostApp().mainWindow().images()[“patch blue right.png”]。无法点击images()[4]。

我已检查图像是否有效。但是图像是不可见的。
有人能告诉我我是否不能点击有效但不可见的元素吗?

要回答您的问题,不,您不能点击不可见的元素


录制时,行被截断:target.tap({x:176.00,y:168.00});但在播放时,该图像不会被点击。如果根据IsVisible(),图像不可见,那么记录的坐标是什么,有人能帮我吗?元素可能有效,但隐藏[element setHidden:TRUE],不符合接收点击的条件。UIUatomation不能像实际用户那样点击。实际上,我可以手动点击图像,也就是说,我可以看到图像,但在播放/自动化过程中,图像不会被捕获。在这种情况下,问题可能在于上面的代码。您确定“target.frontMostApp().mainWindow().images()[“patch blue right.png”].images()[4]”正确吗?里面有两张图片似乎很奇怪。获取正确元素的一个好方法是在脚本中使用record按钮并点击图像。好的,我甚至尝试过,所以它被记录为target.tap({x:176.00,y:168.00});也就是说,正在记录坐标。但在播放时,它不会点击所需的图像。