WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

How to call POST /session/:sessionId/element/active

Open rameghwa opened this issue 9 years ago • 3 comments

How can I call the following api from C#. I am testing a UWP app on windows 10.

POST /session/:sessionId/element/active

Get the element on the page that currently has focus.

active(cb) -> cb(err, element)

https://github.com/admc/wd/blob/master/doc/api.md

rameghwa avatar Jun 13 '17 12:06 rameghwa

If you are using Appium.WebDriver like we do in our samples and tests, you can get the current active element as follows:

WindowsElement activeElement = session.SwitchTo().ActiveElement() as WindowsElement;

More tests are being added to our repo to cover all the API endpoint we support.

timotiusmargo avatar Jun 14 '17 18:06 timotiusmargo

Thank you very much for your response. It is very helpful in finding the current active element on the screen. It will be more helpful if more test cases are added and documentation is improved for the apis supported. In my case for C#.

rameghwa avatar Jun 15 '17 06:06 rameghwa

My pleasure. Yes our goal is to make it very easy to get a sample code and to run any API endpoint we support. Please stay tune to this upcoming updates to the samples and tests.

timotiusmargo avatar Jun 15 '17 20:06 timotiusmargo