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.
This commit is contained in:
@@ -128,7 +128,6 @@ def _allocate_vm(region=DEFAULT_REGION, screen_size=(1920, 1080)):
|
|||||||
waiter.wait(InstanceIds=[instance_id])
|
waiter.wait(InstanceIds=[instance_id])
|
||||||
logger.info(f"Instance {instance_id} is ready.")
|
logger.info(f"Instance {instance_id} is ready.")
|
||||||
|
|
||||||
# 获取并显示VNC访问地址
|
|
||||||
try:
|
try:
|
||||||
instance_details = ec2_client.describe_instances(InstanceIds=[instance_id])
|
instance_details = ec2_client.describe_instances(InstanceIds=[instance_id])
|
||||||
instance = instance_details['Reservations'][0]['Instances'][0]
|
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"📡 Public IP: {public_ip}")
|
||||||
logger.info(f"🆔 Instance ID: {instance_id}")
|
logger.info(f"🆔 Instance ID: {instance_id}")
|
||||||
logger.info("="*80)
|
logger.info("="*80)
|
||||||
print(f"\n🌐 VNC访问地址: {vnc_url}")
|
print(f"\n🌐 VNC Web Access URL: {vnc_url}")
|
||||||
print(f"📍 请在浏览器中打开上述地址进行远程桌面访问\n")
|
print(f"📍 Please open the above address in the browser for remote desktop access\n")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Failed to get VNC address for instance {instance_id}: {e}")
|
logger.warning(f"Failed to get VNC address for instance {instance_id}: {e}")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|||||||
@@ -29,6 +29,32 @@
|
|||||||
"chrome"
|
"chrome"
|
||||||
],
|
],
|
||||||
"evaluator": {
|
"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",
|
"func": "exact_match",
|
||||||
"result": {
|
"result": {
|
||||||
"type": "enable_do_not_track"
|
"type": "enable_do_not_track"
|
||||||
|
|||||||
@@ -29,6 +29,32 @@
|
|||||||
"chrome"
|
"chrome"
|
||||||
],
|
],
|
||||||
"evaluator": {
|
"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",
|
"func": "is_expected_bookmarks",
|
||||||
"result": {
|
"result": {
|
||||||
"type": "bookmarks"
|
"type": "bookmarks"
|
||||||
|
|||||||
@@ -47,6 +47,12 @@
|
|||||||
"--remote-debugging-port=1337"
|
"--remote-debugging-port=1337"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "sleep",
|
||||||
|
"parameters": {
|
||||||
|
"seconds": 3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"func": "exact_match",
|
"func": "exact_match",
|
||||||
|
|||||||
@@ -254,6 +254,12 @@
|
|||||||
"--remote-debugging-port=1337"
|
"--remote-debugging-port=1337"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "sleep",
|
||||||
|
"parameters": {
|
||||||
|
"seconds": 3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"func": "check_history_deleted",
|
"func": "check_history_deleted",
|
||||||
|
|||||||
@@ -47,6 +47,12 @@
|
|||||||
"--remote-debugging-port=1337"
|
"--remote-debugging-port=1337"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "sleep",
|
||||||
|
"parameters": {
|
||||||
|
"seconds": 3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"func": "check_enabled_experiments",
|
"func": "check_enabled_experiments",
|
||||||
|
|||||||
@@ -38,6 +38,32 @@
|
|||||||
"chrome"
|
"chrome"
|
||||||
],
|
],
|
||||||
"evaluator": {
|
"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",
|
"func": "is_expected_bookmarks",
|
||||||
"result": {
|
"result": {
|
||||||
"type": "bookmarks"
|
"type": "bookmarks"
|
||||||
|
|||||||
@@ -38,6 +38,32 @@
|
|||||||
"chrome"
|
"chrome"
|
||||||
],
|
],
|
||||||
"evaluator": {
|
"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",
|
"func": "is_cookie_deleted",
|
||||||
"result": {
|
"result": {
|
||||||
"type": "cookie_data",
|
"type": "cookie_data",
|
||||||
|
|||||||
@@ -31,10 +31,27 @@
|
|||||||
"evaluator": {
|
"evaluator": {
|
||||||
"postconfig": [
|
"postconfig": [
|
||||||
{
|
{
|
||||||
"type": "execute",
|
"type": "launch",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"command": "pkill chrome",
|
"command": [
|
||||||
"shell": "true"
|
"pkill",
|
||||||
|
"chrome"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "launch",
|
||||||
|
"parameters": {
|
||||||
|
"command": [
|
||||||
|
"google-chrome",
|
||||||
|
"--remote-debugging-port=1337"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "sleep",
|
||||||
|
"parameters": {
|
||||||
|
"seconds": 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -31,10 +31,27 @@
|
|||||||
"evaluator": {
|
"evaluator": {
|
||||||
"postconfig": [
|
"postconfig": [
|
||||||
{
|
{
|
||||||
"type": "execute",
|
"type": "launch",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"command": "pkill chrome",
|
"command": [
|
||||||
"shell": "true"
|
"pkill",
|
||||||
|
"chrome"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "launch",
|
||||||
|
"parameters": {
|
||||||
|
"command": [
|
||||||
|
"google-chrome",
|
||||||
|
"--remote-debugging-port=1337"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "sleep",
|
||||||
|
"parameters": {
|
||||||
|
"seconds": 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -47,6 +47,12 @@
|
|||||||
"--remote-debugging-port=1337"
|
"--remote-debugging-port=1337"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "sleep",
|
||||||
|
"parameters": {
|
||||||
|
"seconds": 3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"func": "check_font_size",
|
"func": "check_font_size",
|
||||||
|
|||||||
@@ -31,28 +31,11 @@
|
|||||||
"evaluator": {
|
"evaluator": {
|
||||||
"postconfig": [
|
"postconfig": [
|
||||||
{
|
{
|
||||||
"type": "execute",
|
"type": "launch",
|
||||||
"parameters": {
|
|
||||||
"command": [
|
|
||||||
"python3",
|
|
||||||
"-c",
|
|
||||||
"import pyautogui; pyautogui.press('f5')"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "sleep",
|
|
||||||
"parameters": {
|
|
||||||
"seconds": 3
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "execute",
|
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"command": [
|
"command": [
|
||||||
"pkill",
|
"pkill",
|
||||||
"-f",
|
"chrome"
|
||||||
"google-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",
|
"type": "sleep",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
|
|||||||
Reference in New Issue
Block a user