New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it possible for custom converters to get access to the library #4510
Comments
We already now check how many arguments the converter accepts to validate that the converter is valid. We currently require it to accept exactly one positional argument. For forward compatibility reasons we should make that validation a bit less string already in RF 6.0 so that the converter can accept more arguments as long as those arguments aren't mandatory. We should, for example, allow using |
This feature still seems to lack documentation. |
Custom converters are a handy feature added in RF 5.0 (#4088). It would be convenient if converters would be able to access the library they are attached to. This would allow conversion to be dependent on the state of the library or the automated application. For example, we web testing library could automatically check does a locator string (id, xpath, css, ...) match any object on the page and pass a reference to the object to the keyword.
A simple way to support this would be passing the library instance to the converter along with the value to be converted:
For backwards compatibility reasons we cannot make the second argument mandatory and needing to use it in cases where it's not needed wouldn't be convenient in general. We can, however, easily check does the converter accept one or two arguments and pass it the library instance only in the latter case.
The text was updated successfully, but these errors were encountered: