add new examples for chrome
This commit is contained in:
@@ -9,6 +9,22 @@ from desktop_env.evaluators.metrics.utils import are_lists_equal, compare_urls
|
||||
logger = logging.getLogger("desktopenv.metrics.chrome")
|
||||
|
||||
|
||||
def is_expected_active_tab(active_tab_info: Dict[str, str], rule: Dict[str, Any]) -> float:
|
||||
"""
|
||||
Checks if the expected active tab is open in Chrome.
|
||||
"""
|
||||
match_type = rule['type']
|
||||
|
||||
if match_type == "url":
|
||||
expected_url = rule['url']
|
||||
actual_url = active_tab_info['url']
|
||||
print("expected_url: {}".format(expected_url))
|
||||
print("actual_url: {}".format(actual_url))
|
||||
return 1 if compare_urls(expected_url, actual_url) else 0
|
||||
else:
|
||||
logger.error(f"Unknown type: {match_type}")
|
||||
return 0
|
||||
|
||||
def is_expected_tabs(open_tabs: List[Dict[str, str]], rule: Dict[str, Any]) -> float:
|
||||
"""
|
||||
Checks if the expected tabs are open in Chrome.
|
||||
|
||||
Reference in New Issue
Block a user