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[1]/AXButton/AXPopover[0]/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.
I see there’s no reply on this. I compiled the code by-myself and get this working using AXFocusedWindow.AXChildren. But now I am fighting with another problem: when I’m clicking on a status bar icon to open a popup, for some reason, it is not focused when shown. If I click on it manually - everything works. I cannot make it focused using any programmatic way (ActionChains, pyautoui). Any ideas why?
Solved the problem with this: Actions(driver).click(bar_icon).wait(<wait_for_the_popup_to_appear_time>).move_by_offset(<relative_offset_of_the_popup>).click().perform()
Same issue happens to me. Could someone explain a solution for this query ?
How to click on a UI element in a mac application which launches as a popover window from menu bar ?