UI automation frameworks can't see the elements on windows desktop

Question:

I have a problem with accessing elements from Desktop after cloning and starting a Virtual machine’s snapshot.
While catching the VM in the mentioned state, using pywinauto leads to a tree that looks like this:

Pane - 'Program Manager'    (L0, T0, R1920, B1200)
['Program ManagerPane', 'Program Manager', 'Pane']
child_window(title="Program Manager", control_type="Pane")
   | 
   | ListBox - 'Desktop'    (L0, T0, R1920, B1200)
   | ['Desktop', 'DesktopListBox', 'ListBox']
   | child_window(title="Desktop", auto_id="1", control_type="List")
   |    | 
   |    | ListItem - ''    (L0, T0, R0, B0)
   |    | ['ListItem', 'ListItem0', 'ListItem1']
   |    | 
   |    | ListItem - ''    (L0, T0, R0, B0)
   |    | ['ListItem2']
   |    | 
   |    | ListItem - ''    (L0, T0, R0, B0)
   |    | ['ListItem3']
   |    | 
   |    | ListItem - ''    (L0, T0, R0, B0)
   |    | ['ListItem4']
   |    | 
   |    | ListItem - ''    (L0, T0, R0, B0)
   |    | ['ListItem5']
   |    | 
   |    | ListItem - ''    (L0, T0, R0, B0)
   |    | ['ListItem6']
   |    | 
   |    | ListItem - ''    (L0, T0, R0, B0)
   |    | ['ListItem7']`

Using FlaUInspect with UIA2 mode or Nexial allows me to get the path to the elements from the Desktop

/Pane[@Name='Program Manager']/List[@Name='Desktop']/ListItem[@Name='Folder_with_app_installer']

However, using the path in RobotFramework-FlaUIlibrary only leads to an error mentioning, that the element was not found.
Pywinauto results in the same error.

In our test automation, we usually install the software using Admin account on the VM, then relogging back to user and start the SW.
I tried to save time skipping the relogging and install all the tested SW under User account. Through this effort I discovered the mentioned issue.
What seems strange to me the most is, that if I keep the installation under Admin, start the installers via PowerShell, "clickity-click" through the installation dialogue and relog back to User, all the elements from Desktop are accessible.
I tried to add 2 dummy test cases at the start of my suite – relog to Admin, relog to User, (and install the SW under User) but even after this, the Desktop elements were not accessible.

Do you have any idea what might be causing this behavior?

Asked By: TiredFox

||

Answers:

Problem solved.
The cause of the elements “invisibility” lay in the user under which the test suite was started.
We run our tests from the Administrator console which can not reach the elements on the User desktop.
The solution was pretty easy – when it is necessary, 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 to someone.

Answered By: TiredFox