Tell Robot Framework that this keyword runs other keywords internally.
*NOTE:* This API will change in the future. For more information see
https://github.com/robotframework/robotframework/issues/2190.
:param library: Name of the library the keyword belongs to.
:param keyword: Name of the keyword itself.
:param args_to_process: How many arguments to process normally before
passing them to the keyword. Other arguments are not touched at all.
:param deprecation_warning: Set to ``False```to avoid the warning.
Registered keywords are handled specially by Robot so that:
- Their arguments are not resolved normally (use ``args_to_process``
to control that). This basically means not replacing variables or
handling escapes.
- They are not stopped by timeouts.
- If there are conflicts with keyword names, these keywords have
*lower* precedence than other keywords.
Main use cases are:
- Library keyword is using `BuiltIn.run_keyword` internally to execute other
keywords. Registering the caller as a "run keyword variant" avoids variables
and escapes in arguments being resolved multiple times. All arguments passed
to `run_keyword` can and should be left unresolved.
- Keyword has some need to not resolve variables in arguments. This way
variable values are not logged anywhere by Robot automatically.
As mentioned above, this API will likely be reimplemented in the future
or there could be new API for library keywords to execute other keywords.
External libraries can nevertheless use this API if they really need it and
are aware of the possible breaking changes in the future.
Examples::
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword
def my_run_keyword(name, *args):
# do something
return BuiltIn().run_keyword(name, *args)
register_run_keyword(__name__, 'My Run Keyword')
-------------
from robot.libraries.BuiltIn import BuiltIn, register_run_keyword
class MyLibrary:
def my_run_keyword_if(self, expression, name, *args):
# Do something
if self._is_true(expression):
return BuiltIn().run_keyword(name, *args)
# Process one argument normally to get `expression` resolved.
register_run_keyword('MyLibrary', 'my_run_keyword_if', args_to_process=1)
Definition at line 4016 of file BuiltIn.py.