mardi 27 octobre 2020

How to interact with menu items in a desktop app that do not fall under Desktop pane?

I am testing an application which has a few context menus that I need to interact with.

One of the context menus I am working with does not show up under the Desktop level in the tree when I inspect it using Accessibility Insights image

Image attached. [1]: https://i.stack.imgur.com/eWICJ.png

I tried creating a root driver

AppiumOptions options = new AppiumOptions();
options.AddAdditionalCapability("app", "Root");
options.AddAdditionalCapability("platformName", "Windows");
options.AddAdditionalCapability("deviceName", "WindowsPC");
options.SetLoggingPreference(LogType.Server, LogLevel.All); //optional
secondarySession = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), options);

And then accessing one of the elements on the context menu like this -

var createExp = secondarySession.FindElementByName("Create Related Experiment");
secondarySession.Mouse.MouseMove(createExp.Coordinates);
secondarySession.Mouse.Click(null);

However, it errors out saying element could not be located

POST /session/2355654F-EA56-4247-8BA8-CD4DA462D22C/element HTTP/1.1 Accept: application/json, image/png Content-Length: 52 Content-Type: application/json;charset=utf-8 Host: 127.0.0.1:4723 User-Agent: selenium/3.141.0 (.net windows)

{"using":"name","value":"Create Related Experiment"} HTTP/1.1 404 Not Found Content-Length: 139 Content-Type: application/json

{"status":7,"value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters."}}

The menu is not attached to the application and to the root session as well. Is there a way to interact with such elements using WinAppDriver? Any help is appreciated.

I am using Windows 10 and WAD v1.1

Thanks, Rachit

Aucun commentaire:

Enregistrer un commentaire