Desktop RPA. spaces in application name causing issues

Hello experts,

I’m trying to perform a “Control Window” on an application with the following name :
Session Manager - bzw2h

Please note there are two spaces on either side of the hyphen.

Using the name directly gives an error:

Open Unix
    Control Window         name:Session Manager  -  bzw2h

gives the following error:
[FAIL INSIDE] ValueError: Argument ‘wait_time’ got value ‘bzw2h’ that cannot be converted to float or None.

Passing the name into a variable first does not work. “Session Manager - bzw2h” becomes
“Session Manager - bzw2h” and the locator will not find the window.

Before the string is passed into the variable there are two spaces on either side of the Hyphen. Afterwards there are only one spaces on either side of the hyphen.

*** Variables ***
${window_title}    Session Manager  -  bzw2h

*** Tasks ***
Open Unix
    Control Window        name:${window_title}

[FAIL INSIDE] WindowControlError: Could not locate window with locator: ‘name:Session Manager - bzw2h’ (timeout: 10)

I have also tried to use regex and it does not work:

Open Unix
    Control Window        name:regex:.*Session Manager*

[FAIL INSIDE] WindowControlError: Could not locate window with locator: ‘name:regex:.Session Manager’ (timeout: 10)

Any guidance would be appreciated.

Hello and welcome to the forum. If the element locator contains spaces then double quotes are needed.
So these should work:

Control Window         name:"Session Manager  -  bzw2h"
Control Window        name:regex:".*Session Manager*"

For regex also this should:

Control Window        name:regex:.*Session\sManager.*

Hey raivo ,

For whatever reason none of these work:

Control Window         name:"Session Manager  -  bzw2h"

ValueError: Argument ‘wait_time’ got value ‘bzw2h"’ that cannot be converted to float or None.

Control Window        name:regex:.*Session\sManager.*

COMError: (-2147220991, ‘An event was unable to invoke any of the subscribers’, (None, None, None, 0, None))

Control Window        regex:.*Session\sManager.*

WindowControlError: Could not locate window with locator: ‘regex:.SessionsManager.’ (timeout: 10)

Is it possible the program I’m trying to automate is not compatible?

Here is the information from accessibility insights:
2023-07-11 10_24_24-Accessibility Insights for Windows - Inspect - Live

Could you try with

Control Window    regex:".*Session Manager.*"
or
Control Window    regex:".*Session.*"

Can you share what is target application?

1 Like

This works. Can you explain whats going on here?

Is the above not working because of a bug? Why does the keyword “Control Window” think “bzw2h” is the time out parameter rather than a part of the string encapsulated by the double quotes?

FYI , I ended up using the following.

Control Window    regex:"Session Manager.*bzw2h"

Thank you for all your help !