Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Browser/base/librarycomponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
from time import sleep
from typing import TYPE_CHECKING, Any

from robot import version as robot_version

if robot_version.get_version() >= "7.4":
from robot.api.types import Secret
Comment on lines +28 to +29
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

robot_version.get_version() is being compared to the string "7.4". Lexicographic string comparison will mis-detect versions like 7.10.x and 10.x (e.g., "10.0" < "7.4"), which would disable Secret support on newer Robot Framework versions. Use a robust check instead (e.g., try/except importing robot.api.types.Secret, or parse the version into numeric parts before comparing).

Suggested change
if robot_version.get_version() >= "7.4":
from robot.api.types import Secret
try:
from robot.api.types import Secret
except ImportError:
pass

Copilot uses AI. Check for mistakes.
from robot.libraries.BuiltIn import BuiltIn, RobotNotRunningError
from robot.utils import timestr_to_secs

Expand Down Expand Up @@ -249,7 +253,9 @@ def resolve_secret(self, secret_variable: Any, arg_name: str) -> str:
"Use special variable syntax ($var instead of ${var}) "
"to prevent variable values from being spoiled."
)
return secret
if robot_version.get_version() < "7.4":
return secret
return secret.value if isinstance(secret, Secret) else secret
Comment on lines +256 to +258
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new Secret-specific behavior in resolve_secret (unwrapping Secret.value) is not covered by the existing unit tests for this method. Add a pytest that conditionally imports robot.api.types.Secret (skip if unavailable) and asserts that passing a Secret (and a dict containing Secret values, if supported) returns plain strings.

Copilot uses AI. Check for mistakes.

def decrypt_with_crypto_library(self, secret):
if not isinstance(secret, str) or not re.match(r"^crypt:(.*)", secret):
Expand Down
Loading