I am attempting to automate a Cocoa based application on OS X using Appium for Mac.
User interaction with the application is only via a popover anchored through a menu bar item.
For example: https://koenig-media.raywenderlich.com/uploads/2017/07/show-QuotesViewController.png
Once I click on the application icon in the menu bar, I am unable to navigate to any of the elements inside the popover using xpath. (for example: “/AXApplication[@AXTitle=‘App_Name’]/AXMenuBar/AXButton/AXPopover/AXButton[@AXTitle=‘Enable’]”
I suspect the problem is that Appium for Mac is not able to detect the presence of a popover, and therefore driver.page_source continues to refer to the previous XML. Since popovers are loaded in the view hierarchy only once you click on the menu icon, all attempts to find the elements using xpath are not successful since the XML is not updated.
driver.window_handles continues to show ‘0’ even after the popover is displayed on screen. All attempts to use driver.switch_to (using default_content, window, active element etc) have not helped.
If I use atomac (https://github.com/pyatom/pyatom), I am able to change focus to the popover by calling AXFocusedWindow on the application object after the click (press) action. Since Appium for Mac also uses the Accessibility API provided by Apple, I was wondering if there is a way to get this to work using Appium for Mac.