iOS 8.1 simulator - page :UIAButton return [nil]

Hi, I’m trying to use Appium console to get all the elements, and I could see 3 UIAButton in that screen, but when I tried to see the details, I got [nil]… any idea what does it mean? I’m trying to click on one of the UIAButton, but I’ll get error to complain cannot click that UIAButton. Many thanks!

[2] pry(main)> page_class
29x UIAKey
6x UIAElement
4x UIAWindow
3x UIAButton
1x UIAStaticText
1x UIATableCell
1x UIATableView
1x UIAKeyboard
1x UIAStatusBar
1x UIAApplication
nil
[3] pry(main)> page :UIAButton
nil
[4] pry(main)> page :UIAButton
nil
[5] pry(main)> page_class
29x UIAKey
5x UIAElement
4x UIAWindow
3x UIAButton
1x UIAStaticText
1x UIATableCell
1x UIATableView
1x UIAKeyboard
1x UIAStatusBar
1x UIAApplication
nil

I tried to record a session from Instrument Automation tool, and I will see the following error:
Script threw an uncaught JavaScript error: target.frontMostApp().mainWindow().tableViews()[0] could not be tapped because the element is not visible on line 9 of 81

Try a different window number:

  • page class: :UIAButton, window: 0
  • page class: :UIAButton, window: 1

The page method is restricted to one window at a time (often the other windows contain extra elements that are useless most of the time). The page_class method works across all windows.

Also try: puts get_page(get_source)

Thank you so much! I’ve tried this, and this helped me figured out why my click not works!