pywinauto_recorder.player.find

pywinauto_recorder.player.find(element_path=None, regex=False, timeout=None)[source]

Finds the element matching element_path.

This function is called in all the other functions (click(), move(), …) that require to search an element. To significantly increase search performance, the user can enable a cache with ‘Player.Setting.use_cache = True’. When the cache is active, it is sometimes necessary to empty it with the find_cache_clear() function.

When the [] operator is used and only one element is found, the row and column indices are not tested and the element is returned.

Example of code using the ‘find’ function:
from pywinauto_recorder.player import UIPath, find
with UIPath("RegEx: .* Google Chrome$||Pane"):
        find().set_focus()  # Set focus to the Google Chrome window.

The code above will set focus to the Google Chrome window. The find() function is used to find the Pywinauto wrapper of the window. It will work only if the window is not minimized.

Parameters
  • element_path (Union[str, UIAWrapper, NewType()(UI_Coordinates, (float, float)), None]) – element path

  • regex (bool) – The parameter ‘regex’ is deprecated. Please use the new RegEx syntax of UIPath!

  • timeout (Optional[float]) – duration in seconds that will be allowed to find the element

Return type

UIAWrapper

Returns

Pywinauto wrapper of found element

Raises

FailedSearch – if the element is not found