Hi ,I wanted to capture the Right Click menu from Spy Window Objects

Hi,
I wanted to capture the right click menu on my AUT(Windows Application). But all objects section, it fails to detect those objects. Tried using Native recorder, it fails when re-run the test because the position of right click menu always changes. Any ideas on capturing the right click menu and lock the element ? So that I can get consistent result every time rerun the test.

1 Like

https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Open%20Context%20Menu

Hi @prem.nadarajah,

Welcome to our community. Thank you for letting us know your issue.

I found a great discussion on dynamic object testing and how to handle it: Dynamic Objects How to Make - #32 by josh.meeks. Please take a look and let me know if it does not help. Thank you

Hi I am not sure but I think your example for to Web based product. I am trying to capture the right click context menu from the desktop application. Do you have example how people capture for Desktop product using Spy Window Objects,

You can also try looking into using the Inspect.exe tool, or the tool Microsoft was recommending that replaced that, for viewing object properties if Katalon isn’t picking them up properly.

You might also be able to just create a new object in your test case using the “Names”…when you right click and open the menu, theoretically you should be able to create a RemoteWebElement using the names from the menu.

EX:

  • Right click
  • RemoteWebElement open = Windows.getDriver().FindElementByName(“Open”)
  • open.click()
  • RemoteWebElement multiport = Windows.getDriver().FindElementByName("Multiport)

etc

You could theoretically also manually create a WindowsTestObject with those properties (setting the name) and when the menu is open, you should be able to call that Windows object.

Also, those menu items should all be of a specific class (often class of ListItem), so you could create a list of elements with that class and select the desired element from the list.