Set Global Timeout and Timeout in RPA.WINDOWS

Good night friends!
I am using rpa.windows to automate some desktop processes.
When specifying a Timeout for Keyword Control Window or Set Global Timeout the test takes 180 seconds to break.
Note in the log below that more than one search is done taking 60 seconds between them, but a 5 second time -out was specified for testing.

Python 3.11.3
robotframework 6.1.1
rpaframework 27.5.0
rpaframework-windows 7.4.1

Any tips?

Thanks

*** Settings ***
Library RPA.Windows
*** Variables ***

*** Test Cases ***
test one
Set Global Timeout 5
Control Window class:Notepad
*** Keywords ***

Result:
KEYWORD RPA.Windows . Control Window class:Notepad
Documentation:
Controls the window defined by the locator.
Tags: window
Start / End / Elapsed: 20240616 20:13:31.875 / 20240616 20:15:33.340 / 00:02:01.465
20:13:31.942 INFO Getting element with locator: class:Notepad and type:WindowControl

20:13:31.942 INFO Resulted root element: WindowsElement(item=<uiautomation.uiautomation.PaneControl object at 0x00000213E60BD9D0>, locator=‘class:Notepad and type:WindowControl’, name=‘Área de Trabalho 1’, automation_id=‘’, control_type=‘PaneControl’, class_name=‘#32769’, left=0, right=1920, top=0, bottom=1080, width=1920, height=1080, xcenter=960, ycenter=540)
20:13:31.942 INFO Locator ‘class:Notepad and type:WindowControl’ produced matcher: MatchObject(locators=[(‘ClassName’, ‘Notepad’, 0), (‘ControlType’, ‘WindowControl’, 0)], _classes={‘notepad’}, max_level=0)

20:14:32.676 INFO Getting element with locator: class:Notepad and type:PaneControl

20:14:32.676 INFO Resulted root element: WindowsElement(item=<uiautomation.uiautomation.PaneControl object at 0x00000213E5ECBA50>, locator=‘class:Notepad and type:PaneControl’, name=‘Área de Trabalho 1’, automation_id=‘’, control_type=‘PaneControl’, class_name=‘#32769’, left=0, right=1920, top=0, bottom=1080, width=1920, height=1080, xcenter=960, ycenter=540)

20:14:32.676 INFO Locator ‘class:Notepad and type:PaneControl’ produced matcher: MatchObject(locators=[(‘ClassName’, ‘Notepad’, 0), (‘ControlType’, ‘PaneControl’, 0)], _classes={‘notepad’}, max_level=0)

20:15:33.340 INFO 2024-06-16 20:14:32.676 locators.py[274] _get_control_from_params → Find Control Timeout(5.0s): {ClassName: ‘Notepad’, ControlType: WindowControl}
2024-06-16 20:15:33.340 locators.py[274] _get_control_from_params → Find Control Timeout(5.0s): {ClassName: ‘Notepad’, ControlType: PaneControl}

20:15:33.340 FAIL WindowControlError: Could not locate window with locator: ‘class:Notepad’ (timeout: 5.0)

Hello,

It looks like the Set Global Timeout is not being respected, and the Control Window keyword is retrying multiple times over a 180-second period instead of stopping after 5 seconds. Here are some possible reasons and solutions:

Possible Causes & Fixes

  1. Global Timeout Might Not Affect Window Searches
    The Set Global Timeout keyword sets a timeout for all waiting actions but does not necessarily apply to Control Window. The timeout for Control Window may be controlled separately.

:white_check_mark: Solution: Try explicitly setting the timeout when calling Control Window:

robot
Copy
Edit
Control Window class:Notepad timeout=5
If the keyword does not accept a timeout parameter, we might need to use a different approach.
MD Health Connection
2. Default Timeout in rpaframework-windows
The library may have a default timeout of 60 seconds for each retry attempt, which explains why it takes 180 seconds (3 retries of 60 seconds each).

:white_check_mark: Solution: Override the default timeout:

robot
Copy
Edit
*** Settings ***
Library RPA.Windows timeout=5
This ensures all Windows automation calls use a 5-second timeout instead of the default.

  1. Control Window May Be Searching for Multiple Elements
    Your log shows:

20:13:31.942 → First search
20:14:32.676 → Second search (~60 seconds later)
20:15:33.340 → Third search (~60 seconds later)
This suggests that Control Window retries three times before failing.
:white_check_mark: Solution: Try Find Element instead of Control Window:

robot
Copy
Edit
Wait Until Element Exists class:Notepad timeout=5
Then, if it exists, you can interact with it.

  1. Control Window Locator Might Be Wrong
    The log shows:

log
Copy
Edit
Locator ‘class:Notepad and type:WindowControl’ produced matcher
Locator ‘class:Notepad and type:PaneControl’ produced matcher
The first search looks for WindowControl, but later it searches for PaneControl.

:white_check_mark: Solution: Try using a more specific locator:

robot
Copy
Edit
Control Window title=Untitled - Notepad
Or:

robot
Copy
Edit
Control Window automation_id=Notepad
You can find the correct locator using Inspect.exe (Windows built-in tool).

Summary of Fixes to Try
Set the timeout directly in Control Window:
robot
Copy
Edit
Control Window class:Notepad timeout=5
Override the library-wide timeout:
robot
Copy
Edit
*** Settings ***
Library RPA.Windows timeout=5
Use Wait Until Element Exists:
r
Copy
Edit
Wait Until Element Exists class:Notepad timeout=5
Use a more precise locator:
robot
Copy
Edit
Control Window title=Untitled - Notepad
Try these fixes and let me know if the issue persists!

Best Regards