Sometimes you will want to catch LookupErrors where the exact reason that the control in question is not present is irrelevant. For example if you have a Popup that may or may not show up at a certain point in the automation of the application.
In this case the dialog that is shown for ‘Object not found’-debugging can be hindering because it stops the test execution.
There is a simple way to disable this dialog, by setting testSettings.objectNotFoundDebugging to the equivalent of false for the respective script language.
In Python a neat way to deactivate this is using function decorators. For this you define the function that works as decorator
This function can be either defined in the test module itself or imported from a global module. Then you define the function with the object lookup like this
The decorator wraps the function during its execution and restores testSettings.objectNotFoundDebugging to its previous value after the function was executed.