0

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?

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
TiredFox
  • 11
  • 1
  • When you run an installer, you're usually going to go through the UAC "user account control" dialog that allows the process to run elevated. That process runs in a separate window station with a desktop that is not accessible from normal programs. I wonder if that's what you're seeing. – Tim Roberts May 04 '23 at 23:05
  • Thanks a lot for reacting. The mentioned issue occurs before running any installer. The list with " ListItem - '' (L0, T0, R0, B0)" is a list of elements on desktop - e.g. instead of a shortcut or a folder on a Desktop, the pywinauto sees only several undefined "ListItems" - I can confirm, that the elements really exists on the Desktop and are manually clickable and usable. – TiredFox May 05 '23 at 07:32

1 Answers1

0

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.

TiredFox
  • 11
  • 1