Closed gitkatsi closed 8 months ago
@allcontributors please add @gitkatsi bugs.
It seems that we try to resolve variables from RF side when RF is not running. But in this case we should not do it.
@aaltat
I've put up a pull request to add @gitkatsi! :tada:
I think this will not work:
br.new_context(httpCredentials={'username': "$name}", 'password': "$password"})
because if Robot is not running, then we can not resolve variables from Robot context. In this case raising an exception is the way to go. We should discuss is the raised exception correct one or should it be changed? I do not have strong opinion in either direction.
But I think we should allow, when running without RF, this one:
br.new_context(httpCredentials={'username': "name", 'password': "password"})
Because in this case logging is/can be controlled by user more accurately. Also it is more convenient to do from Python side.
Also should check with test that resolving environment variables do work:
br.new_context(httpCredentials={'username': "%name", 'password': "%password"})
without Robot context.
br.new_context(httpCredentials={'username': "%name", 'password': "%password"})
prints
Given variable placeholder could not be resolved.
Given variable placeholder could not be resolved.
and resutls again in
ValueError: Direct assignment of values or variables as 'httpCredentials' is not allowed. Use special variable syntax ($var instead of ${var}) to prevent variable values from being spoiled.
Yes, it needs some code changes to work correctly. But because https://robocon.io/ is near and I need to stuff for it, it is likely that fixing will go after the conference.
Describe the bug
Raises Error:
BuiltIn.py", line 86, in _get_context raise RobotNotRunningError('Cannot access execution
context')`To Reproduce Code
Raises
BuiltIn.py", line 86, in _get_context raise RobotNotRunningError('Cannot access execution context')
Code
Raises
\librarycomponent.py", line 215, in resolve_secret raise ValueError( ValueError: Direct assignment of values or variables as 'httpCredentials' is not allowed. Use special variable syntax ($var instead of ${var}) to prevent variable values from being spoiled.
Expected behavior Use httpcredentials for basic http authentication
Desktop (please complete the following information):
Additional context I cannot find a proper syntax to pass httpcredentials in new_context. if i use $ it seems to bypass the Direct Assignment ValueError, but EXECUTION_CONTEXTS.current in builtin is always None and self._contexts an empty array. Tried other execution methods like new browser, new_context without params, but EXECUTION_CONTEXTS.current is always None and self._contexts again an empty array.