Tap command on a button not working in UIAutomation

爷,独闯天下 提交于 2019-12-11 04:19:10

问题


I have this button in an app. I want to simulate a tap on the button. The button is located as follows: target>frontMostApp()>windows()[0]>buttons()[2]. My javascript code is as follows: target.frontMostApp().windows()[0].buttons()[2].tap(); But after running the code, the following error message is shown:

Error: target.frontMostApp().windows()[0].buttons()[2] could not be tapped

I have checked that the accessibility label of this button is set to enabled. Can anyone tell me what I am doing wrong? Below is a screenshot from the instruments console:

The highlighted button is the button I would like to tap.


回答1:


Can you run logElementTree() on the window and paste that in to your question? That error usually means that the element you are looking for isn't valid. Maybe we can help discover the problem by looking at the element tree together.




回答2:


I just solved the problem. It was just that the button I was trying to tap was not visible. I checked with .isVisible() and it returned false. Thanks for the help.



来源:https://stackoverflow.com/questions/10590353/tap-command-on-a-button-not-working-in-uiautomation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!