Elements on Windows desktop are undetectable

Hello everyone,

In our team, we run automated tests on VMs. We do some basic steps on the VM manually (install python, etc.) and take snapshot of that state.
When there are tests to be executed, the snapshot of the VM is used to make a clone of the VM which is then started and the test execution begins.

Here’s where my issue occurs. The initial tests contain installation of the tested software. We usually go through the installation under Admin account and then relog back to User account.
I tried to bypass the relogging by starting the installer from User but “Under different user” via Shift + Right click, instead of relogging to Admin → install → relog back to User.

However, after the VM is cloned and started and the RF test is started, the Windows desktop seems to have only some undefined elements.
(The installer is copied from a network drive on User’s desktop before attempting to click on it.)
Using Pywinauto to get the list of elements on Desktop results in the following tree:

FlaUInspect only detects the real items on Desktop when set to UIA2 mode. Nevertheless, the FlaUI Library cannot reach the XPath in an attempt to Click.

Now what’s the strangest to me.
If I throw away the effort to skip relogging - start the cloned VM → relog to admin → copy an installer to Admin’s desktop → double click the installer → install the SW → relog to User → double click the SW shortcut on User’s desktop → …
Everything works just fine. Both, Pywinauto and FlaUI Library, can access the installers on Admin’s desktop and then also the content of User’s desktop.

I also tried to add 2 dummy TCs at the start of the test suite - relog to admin → sleep few miliseconds, relog to user → sleep few miliseconds.
It didn’t help with accessing the User’s desktop elements either.

Any of you guys have already seen something like this? Do you have any idea what might be the cause of this behavior?


problem solved!
The cause of the elements “invisibility” lied in user under which the test suite was started.
We run our tests from Administrator console which can not reach the elements on the User desktop.
Solution was pretty easy - when it is neccessary, I restart the test suite under the Administrator/User console (the one I want) with only not tested test cases.

I hope this can be helpful for someone.