WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

WinAppdriver tests failures from locked Windows 10 machine

Open sabarishnarain opened this issue 8 years ago • 15 comments

I'm running UI tests on a UWP app where the tests fail with the following exception when the win 10 machine is locked. But tests are running successful otherwise.

I need help understanding what the exception mean

org.openqa.selenium.WebDriverException: Unable to find the given UIObject. Search criteria:'ClassName = Windows.UI.Core.CoreWindow' Search domain:'A collection of MS.Internal.Mita.Foundation.UIObject instances in the set defined as Children of '{My Application, ApplicationFrameWindow, 42.1443280}' ('[Unknown UICondition]') matching: Condition: 'True'..' (WARNING: The server did not provide any stacktrace information)

Source code :

String windowHandle = desktopSession.findElementByName("MyApplication").getAttribute("NativeWindowHandle");

Util.waitFor(5000); DesiredCapabilities viewCaps = new DesiredCapabilities(); viewCaps.setCapability("appTopLevelWindow", toHex(windowHandle));

try { /** exception thrown here **/ viewSession = new WindowsDriver(new URL("myappiumurl"), viewCaps); } catch (MalformedURLException e) { log.error("Exception occured on attaching View session", e); }

sabarishnarain avatar Aug 14 '18 21:08 sabarishnarain

Hi @sabarishnarain,

WinAppDriver doesn't support automation once lockscreen has been initiated as the WAD session gets cut. Can you explain the scenario a bit further (e.g. what initiates the lockscreen)?

Thanks

hassanuz avatar Aug 14 '18 22:08 hassanuz

the device eventually locks up after being idle. I couldn't get our IT team disable lock screen as it appears to be violation of corporate security. I tried ps scripts to login before the tests kicks in, but was out of luck.

I created this issue to understand the root cause. Closing thread.

sabarishnarain avatar Aug 15 '18 02:08 sabarishnarain

This should not be closed. This is a real issue as most corporate environments require the same thing. I just realized the same issue. When I'm RDP'd into the test machine it works, when I'm disconnected (locked) the tests fail.

ronjonesjr avatar Nov 21 '18 19:11 ronjonesjr

I think the owners has to acknowledge this if this case needs to be reopened. @hassanuz ?

ptc-snarain avatar Nov 26 '18 17:11 ptc-snarain

@hassanuz Hi So you mean that its not possible to run the tests on Teamcity server? night schedule for exempel?

Thanks

Saif4 avatar Mar 21 '19 13:03 Saif4

+1 Being able to use WinAppDriver on a locked machine is a necessary use case for running automated tests that may be triggered at any time

orilevari avatar Mar 26 '19 19:03 orilevari

@orilevari The workaround I used is to override security policy with approvals from IT team and turned off auto screen lock. The device is now unlocked forever and will not be a privacy issue since its considered as build machine.

sabarishnarain avatar Mar 31 '19 05:03 sabarishnarain

@hassanuz Since many folks are interested in this, can you guys confirm if this can be taken as a feature request ?

sabarishnarain avatar Mar 31 '19 05:03 sabarishnarain

I would like also to run my tests on my machine when Im at lunch for example but it seems impossible due to WAD session gets cut, I think its a really big issue if there is no support for that!

Did anyone get around this issue?

Saif4 avatar Apr 04 '19 14:04 Saif4

@Saif4 I did on surface device. See comment above. But this not possible with VMs in the cloud.

ptc-snarain avatar Apr 04 '19 14:04 ptc-snarain

Thansk @sabarishnarain But does anyone know if there is any support for that coming any time soon?

Saif4 avatar Apr 25 '19 08:04 Saif4

I am also in need for UI automation running even if the PC is locked. Please let me know if any workaround or solution available to achieve it. Thanks.

pradeepkumar-devaraj avatar Jul 02 '19 13:07 pradeepkumar-devaraj

This will be a good to have feature for me too. Anyhow we had the same limitation in Coded UI so as a workaround we created a simple VB Script to keep windows from locking. But to be able to run all tests when machine is locked is really helpful.

anshul1goel avatar Aug 05 '19 10:08 anshul1goel

There is no way around bypassing the lock screen. It is recommended to disable the lock screen entirely and set your machine up as an interactive agent to run continuously run UI tests.

hassanuz avatar Oct 14 '19 22:10 hassanuz

Hello, Sorry to ask the question even if the discussion is closed. Has anyone by any chance found a solution to this problem. For my part, I work on Java (Test automation) and Jenkins (continuous integration). Thank you in advance for your answers.

MamadouAlphaDiallo avatar Jun 02 '22 12:06 MamadouAlphaDiallo