appium / appium-mac2-driver

Next-gen Appium macOS driver, backed by Apple XCTest
Apache License 2.0
115 stars 24 forks source link

Unable to click on Top menu icons or its submenu items. #178

Closed naagf5 closed 1 year ago

naagf5 commented 1 year ago

CONTEXT: My requirement is to click on Top right icon from available list of icons (I hope we can call it Systemtray in Mac like windows). When i click on that icon, it will show a menu. I need to click on one of menu items listed. (example below) image

Whats Happening. Try-01: I tried to click on the icon with xpath which got from Appium Inspector. The click operation is not failing with no such element present. That means it is able to find the element. The click operation passing but not opennig any menu.

**TRY-02**
  Since it is able to open menu, I manually opened the menu (By keeping a sleep) and made the Menu Item available. This time i tried to click on the Menu Item (instead of expanding Menu). This time also the click operation passing but nothing happening. 

  NOTE: The image is show menu topic i mentioned above. 
  NOTE2: I downloaded the XML from inspector and able to find single item using the XPath i provided.

  XPATH of ICON present in MenuBar:   xpath=/XCUIElementTypeApplication/XCUIElementTypeMenuBar[2]/XCUIElementTypeStatusItem
  XPATH of Menu Item (both working one relative): 
   //XCUIElementTypeMenuItem[@identifier="act_ShowDetails:"]
     and 
 //XCUIElementTypeApplication/XCUIElementTypeMenuBar[2]/XCUIElementTypeStatusItem/XCUIElementTypeMenu/XCUIElementTypeMenuItem[22] 
KazuCocoa commented 1 year ago

If you could get the coordinate, https://github.com/appium/appium-mac2-driver#macos-click may help

mykola-mokhnach commented 1 year ago

If something could be done without touching the UI then I would prefer that method as more reliable:

mykola-mokhnach commented 1 year ago

Also AppleScript approach (less reliable though): https://apple.stackexchange.com/questions/300949/how-to-change-the-spelling-language-in-os-x-with-applescript