You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Library internal argument conversion with Robot Framework API #4109
Browser library has similar run on failure support as SeleniumLibrary has, but Browser library supports arguments with the Register Keyword To Run On Failure keyword. But because registered keyword arguments can be almost anything, Browser library can not define typing for the arguments and therefore Robot Framework can not perform automatic conversion to the arguments. There is an issue which demonstrates the problem when we do not perform the conversion.
Therefore I was thinking to do conversion inside of the library. I think it can be done if the run on failure keyword is one of the browser library keywords, because then library knows the argument specification. But the argument conversion is pretty complex problem to do, so I was thinking that I could use some Robot Framework code. Is there some entry point which would allow to do the conversion easily?
Exposing argument conversion publicly would be a good idea. Not exactly sure what's the best API for that, though. Anyway, something that could be added in RF 5.0.
Could you @aaltat clarify this request a bit more? I checked the linked Browser library issue and notice it was fixed already. Was this issue not relevant or was there some existing way to handle conversion?
I removed this from RF 5.0 scope because we'd like to get that release out ASAP and because I'm not sure what we actually should even do to address this. If there's something concrete to do, this issue can be added to RF 5.1 scope.
I don't actually understand the whole need for argument conversion in Browser side. AFAIK it uses BuiltIn.run_keyword and it should handle conversion based on the type information of the called keyword automatically. For example, if I have a dummy library like
I can use it as follows and 42 is converted to an integer correctly.
*** Test Cases ***Example
kw2 42
BuiltIn.run_keyword is a pretty bad API for running other keywords, though, as #4237 explains. If we add a new and better API, need to take conversion into account with it.
When keyword originates from the same library, arguments are not problem. But keyword is not from same library arguments are problematic because args can be almost anything and then it get pretty complicated how that works. Or is there some shortcut to happiness which I do not see?
Activity
pekkaklarck commentedon Oct 5, 2021
Exposing argument conversion publicly would be a good idea. Not exactly sure what's the best API for that, though. Anyway, something that could be added in RF 5.0.
pekkaklarck commentedon Mar 4, 2022
Could you @aaltat clarify this request a bit more? I checked the linked Browser library issue and notice it was fixed already. Was this issue not relevant or was there some existing way to handle conversion?
I removed this from RF 5.0 scope because we'd like to get that release out ASAP and because I'm not sure what we actually should even do to address this. If there's something concrete to do, this issue can be added to RF 5.1 scope.
pekkaklarck commentedon Mar 4, 2022
I don't actually understand the whole need for argument conversion in Browser side. AFAIK it uses
BuiltIn.run_keywordand it should handle conversion based on the type information of the called keyword automatically. For example, if I have a dummy library likeI can use it as follows and
42is converted to an integer correctly.BuiltIn.run_keywordis a pretty bad API for running other keywords, though, as #4237 explains. If we add a new and better API, need to take conversion into account with it.aaltat commentedon Mar 9, 2022
When keyword originates from the same library, arguments are not problem. But keyword is not from same library arguments are problematic because args can be almost anything and then it get pretty complicated how that works. Or is there some shortcut to happiness which I do not see?
pekkaklarck commentedon May 20, 2025
It seems that #4942 proposed the same thing and it was implemented in RF 7.0.
pekkaklarck commentedon May 20, 2025
@aaltat agreed. Closing.