From 2c51950e7340888e010a48b9408732accdbfdfe1 Mon Sep 17 00:00:00 2001 From: yuanmengqi Date: Thu, 17 Jul 2025 10:50:10 +0000 Subject: [PATCH] feat: enhance evaluator configuration for Chrome with post-execution commands - Added postconfig commands to multiple JSON files for Chrome evaluation examples. - Included commands to terminate existing Chrome processes, launch Chrome with remote debugging, and introduce sleep intervals for timing. - Updated logging messages in the AWS manager to improve clarity and user experience. These changes enhance the automation and usability of the evaluation examples while preserving existing logic. --- desktop_env/providers/aws/manager.py | 5 +- .../030eeff7-b492-4218-b312-701ec99ee0cc.json | 26 ++++++++++ .../2ad9387a-65d8-4e33-ad5b-7580065a27ca.json | 26 ++++++++++ .../2ae9ba84-3a0d-4d4c-8338-3a1478dc5fe3.json | 6 +++ .../44ee5668-ecd5-4366-a6ce-c1c9b8d4e938.json | 6 +++ .../480bcfea-d68f-4aaa-a0a9-2589ef319381.json | 6 +++ .../7a5a7856-f1b6-42a4-ade9-1ca81ca0f263.json | 26 ++++++++++ .../7b6c7e24-c58a-49fc-a5bb-d57b80e5b4c3.json | 26 ++++++++++ .../9656a811-9b5b-4ddf-99c7-5117bcef0626.json | 23 ++++++-- .../99146c54-4f37-4ab8-9327-5f3291665e1e.json | 23 ++++++-- .../af630914-714e-4a24-a7bb-f9af687d3b91.json | 6 +++ .../bb5e4c0d-f964-439c-97b6-bdb9747de3f4.json | 52 +------------------ 12 files changed, 172 insertions(+), 59 deletions(-) diff --git a/desktop_env/providers/aws/manager.py b/desktop_env/providers/aws/manager.py index 2d80380..703359b 100644 --- a/desktop_env/providers/aws/manager.py +++ b/desktop_env/providers/aws/manager.py @@ -128,7 +128,6 @@ def _allocate_vm(region=DEFAULT_REGION, screen_size=(1920, 1080)): waiter.wait(InstanceIds=[instance_id]) logger.info(f"Instance {instance_id} is ready.") - # 获取并显示VNC访问地址 try: instance_details = ec2_client.describe_instances(InstanceIds=[instance_id]) instance = instance_details['Reservations'][0]['Instances'][0] @@ -140,8 +139,8 @@ def _allocate_vm(region=DEFAULT_REGION, screen_size=(1920, 1080)): logger.info(f"📡 Public IP: {public_ip}") logger.info(f"🆔 Instance ID: {instance_id}") logger.info("="*80) - print(f"\n🌐 VNC访问地址: {vnc_url}") - print(f"📍 请在浏览器中打开上述地址进行远程桌面访问\n") + print(f"\n🌐 VNC Web Access URL: {vnc_url}") + print(f"📍 Please open the above address in the browser for remote desktop access\n") except Exception as e: logger.warning(f"Failed to get VNC address for instance {instance_id}: {e}") except KeyboardInterrupt: diff --git a/evaluation_examples/examples/chrome/030eeff7-b492-4218-b312-701ec99ee0cc.json b/evaluation_examples/examples/chrome/030eeff7-b492-4218-b312-701ec99ee0cc.json index 4f9726c..c7114ce 100644 --- a/evaluation_examples/examples/chrome/030eeff7-b492-4218-b312-701ec99ee0cc.json +++ b/evaluation_examples/examples/chrome/030eeff7-b492-4218-b312-701ec99ee0cc.json @@ -29,6 +29,32 @@ "chrome" ], "evaluator": { + "postconfig": [ + { + "type": "launch", + "parameters": { + "command": [ + "pkill", + "chrome" + ] + } + }, + { + "type": "launch", + "parameters": { + "command": [ + "google-chrome", + "--remote-debugging-port=1337" + ] + } + }, + { + "type": "sleep", + "parameters": { + "seconds": 3 + } + } + ], "func": "exact_match", "result": { "type": "enable_do_not_track" diff --git a/evaluation_examples/examples/chrome/2ad9387a-65d8-4e33-ad5b-7580065a27ca.json b/evaluation_examples/examples/chrome/2ad9387a-65d8-4e33-ad5b-7580065a27ca.json index 48a0113..ef753d6 100644 --- a/evaluation_examples/examples/chrome/2ad9387a-65d8-4e33-ad5b-7580065a27ca.json +++ b/evaluation_examples/examples/chrome/2ad9387a-65d8-4e33-ad5b-7580065a27ca.json @@ -29,6 +29,32 @@ "chrome" ], "evaluator": { + "postconfig": [ + { + "type": "launch", + "parameters": { + "command": [ + "pkill", + "chrome" + ] + } + }, + { + "type": "launch", + "parameters": { + "command": [ + "google-chrome", + "--remote-debugging-port=1337" + ] + } + }, + { + "type": "sleep", + "parameters": { + "seconds": 3 + } + } + ], "func": "is_expected_bookmarks", "result": { "type": "bookmarks" diff --git a/evaluation_examples/examples/chrome/2ae9ba84-3a0d-4d4c-8338-3a1478dc5fe3.json b/evaluation_examples/examples/chrome/2ae9ba84-3a0d-4d4c-8338-3a1478dc5fe3.json index c3d0677..14404dd 100644 --- a/evaluation_examples/examples/chrome/2ae9ba84-3a0d-4d4c-8338-3a1478dc5fe3.json +++ b/evaluation_examples/examples/chrome/2ae9ba84-3a0d-4d4c-8338-3a1478dc5fe3.json @@ -47,6 +47,12 @@ "--remote-debugging-port=1337" ] } + }, + { + "type": "sleep", + "parameters": { + "seconds": 3 + } } ], "func": "exact_match", diff --git a/evaluation_examples/examples/chrome/44ee5668-ecd5-4366-a6ce-c1c9b8d4e938.json b/evaluation_examples/examples/chrome/44ee5668-ecd5-4366-a6ce-c1c9b8d4e938.json index b49f40d..39c59f0 100644 --- a/evaluation_examples/examples/chrome/44ee5668-ecd5-4366-a6ce-c1c9b8d4e938.json +++ b/evaluation_examples/examples/chrome/44ee5668-ecd5-4366-a6ce-c1c9b8d4e938.json @@ -254,6 +254,12 @@ "--remote-debugging-port=1337" ] } + }, + { + "type": "sleep", + "parameters": { + "seconds": 3 + } } ], "func": "check_history_deleted", diff --git a/evaluation_examples/examples/chrome/480bcfea-d68f-4aaa-a0a9-2589ef319381.json b/evaluation_examples/examples/chrome/480bcfea-d68f-4aaa-a0a9-2589ef319381.json index 5a9b16e..4ac32ab 100644 --- a/evaluation_examples/examples/chrome/480bcfea-d68f-4aaa-a0a9-2589ef319381.json +++ b/evaluation_examples/examples/chrome/480bcfea-d68f-4aaa-a0a9-2589ef319381.json @@ -47,6 +47,12 @@ "--remote-debugging-port=1337" ] } + }, + { + "type": "sleep", + "parameters": { + "seconds": 3 + } } ], "func": "check_enabled_experiments", diff --git a/evaluation_examples/examples/chrome/7a5a7856-f1b6-42a4-ade9-1ca81ca0f263.json b/evaluation_examples/examples/chrome/7a5a7856-f1b6-42a4-ade9-1ca81ca0f263.json index 49f1cc3..e5f3f17 100644 --- a/evaluation_examples/examples/chrome/7a5a7856-f1b6-42a4-ade9-1ca81ca0f263.json +++ b/evaluation_examples/examples/chrome/7a5a7856-f1b6-42a4-ade9-1ca81ca0f263.json @@ -38,6 +38,32 @@ "chrome" ], "evaluator": { + "postconfig": [ + { + "type": "launch", + "parameters": { + "command": [ + "pkill", + "chrome" + ] + } + }, + { + "type": "launch", + "parameters": { + "command": [ + "google-chrome", + "--remote-debugging-port=1337" + ] + } + }, + { + "type": "sleep", + "parameters": { + "seconds": 3 + } + } + ], "func": "is_expected_bookmarks", "result": { "type": "bookmarks" diff --git a/evaluation_examples/examples/chrome/7b6c7e24-c58a-49fc-a5bb-d57b80e5b4c3.json b/evaluation_examples/examples/chrome/7b6c7e24-c58a-49fc-a5bb-d57b80e5b4c3.json index 610b3ba..d8b0428 100644 --- a/evaluation_examples/examples/chrome/7b6c7e24-c58a-49fc-a5bb-d57b80e5b4c3.json +++ b/evaluation_examples/examples/chrome/7b6c7e24-c58a-49fc-a5bb-d57b80e5b4c3.json @@ -38,6 +38,32 @@ "chrome" ], "evaluator": { + "postconfig": [ + { + "type": "launch", + "parameters": { + "command": [ + "pkill", + "chrome" + ] + } + }, + { + "type": "launch", + "parameters": { + "command": [ + "google-chrome", + "--remote-debugging-port=1337" + ] + } + }, + { + "type": "sleep", + "parameters": { + "seconds": 3 + } + } + ], "func": "is_cookie_deleted", "result": { "type": "cookie_data", diff --git a/evaluation_examples/examples/chrome/9656a811-9b5b-4ddf-99c7-5117bcef0626.json b/evaluation_examples/examples/chrome/9656a811-9b5b-4ddf-99c7-5117bcef0626.json index e0e9d1a..1db5215 100644 --- a/evaluation_examples/examples/chrome/9656a811-9b5b-4ddf-99c7-5117bcef0626.json +++ b/evaluation_examples/examples/chrome/9656a811-9b5b-4ddf-99c7-5117bcef0626.json @@ -31,10 +31,27 @@ "evaluator": { "postconfig": [ { - "type": "execute", + "type": "launch", "parameters": { - "command": "pkill chrome", - "shell": "true" + "command": [ + "pkill", + "chrome" + ] + } + }, + { + "type": "launch", + "parameters": { + "command": [ + "google-chrome", + "--remote-debugging-port=1337" + ] + } + }, + { + "type": "sleep", + "parameters": { + "seconds": 3 } } ], diff --git a/evaluation_examples/examples/chrome/99146c54-4f37-4ab8-9327-5f3291665e1e.json b/evaluation_examples/examples/chrome/99146c54-4f37-4ab8-9327-5f3291665e1e.json index 11a8bc2..ca61400 100644 --- a/evaluation_examples/examples/chrome/99146c54-4f37-4ab8-9327-5f3291665e1e.json +++ b/evaluation_examples/examples/chrome/99146c54-4f37-4ab8-9327-5f3291665e1e.json @@ -31,10 +31,27 @@ "evaluator": { "postconfig": [ { - "type": "execute", + "type": "launch", "parameters": { - "command": "pkill chrome", - "shell": "true" + "command": [ + "pkill", + "chrome" + ] + } + }, + { + "type": "launch", + "parameters": { + "command": [ + "google-chrome", + "--remote-debugging-port=1337" + ] + } + }, + { + "type": "sleep", + "parameters": { + "seconds": 3 } } ], diff --git a/evaluation_examples/examples/chrome/af630914-714e-4a24-a7bb-f9af687d3b91.json b/evaluation_examples/examples/chrome/af630914-714e-4a24-a7bb-f9af687d3b91.json index 728c36f..941e98e 100644 --- a/evaluation_examples/examples/chrome/af630914-714e-4a24-a7bb-f9af687d3b91.json +++ b/evaluation_examples/examples/chrome/af630914-714e-4a24-a7bb-f9af687d3b91.json @@ -47,6 +47,12 @@ "--remote-debugging-port=1337" ] } + }, + { + "type": "sleep", + "parameters": { + "seconds": 3 + } } ], "func": "check_font_size", diff --git a/evaluation_examples/examples/chrome/bb5e4c0d-f964-439c-97b6-bdb9747de3f4.json b/evaluation_examples/examples/chrome/bb5e4c0d-f964-439c-97b6-bdb9747de3f4.json index 91e5304..2e0d9d5 100644 --- a/evaluation_examples/examples/chrome/bb5e4c0d-f964-439c-97b6-bdb9747de3f4.json +++ b/evaluation_examples/examples/chrome/bb5e4c0d-f964-439c-97b6-bdb9747de3f4.json @@ -31,28 +31,11 @@ "evaluator": { "postconfig": [ { - "type": "execute", - "parameters": { - "command": [ - "python3", - "-c", - "import pyautogui; pyautogui.press('f5')" - ] - } - }, - { - "type": "sleep", - "parameters": { - "seconds": 3 - } - }, - { - "type": "execute", + "type": "launch", "parameters": { "command": [ "pkill", - "-f", - "google-chrome" + "chrome" ] } }, @@ -65,37 +48,6 @@ ] } }, - { - "type": "launch", - "parameters": { - "command": [ - "socat", - "tcp-listen:9222,fork", - "tcp:localhost:1337" - ] - } - }, - { - "type": "chrome_open_tabs", - "parameters": { - "urls_to_open": [ - "chrome://settings/search", - "chrome://settings" - ] - } - }, - { - "type": "sleep", - "parameters": { - "seconds": 3 - } - }, - { - "type": "execute", - "parameters": { - "command": ["pkill", "-SIGHUP", "-f", "google-chrome"] - } - }, { "type": "sleep", "parameters": {