File tree Expand file tree Collapse file tree 3 files changed +39
-6
lines changed Expand file tree Collapse file tree 3 files changed +39
-6
lines changed Original file line number Diff line number Diff line change @@ -22,4 +22,5 @@ public/manifest.json
22
22
# benchmarking
23
23
/results
24
24
tasks_test.jsonl
25
- webwand_test_log.txt
25
+ webwand_test_log.txt
26
+ tasks_status.txt
Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ def click_extensions_icon(driver):
174
174
top = window_position ['y' ]
175
175
right = window_position ['x' ] + window_position ['width' ]
176
176
# click Extensions icon
177
- pyautogui .click (right - 150 , top + 50 )
177
+ pyautogui .click (right - 165 , top + 50 )
178
178
# click webwand
179
179
pyautogui .click (right - 300 , top + 210 )
180
180
@@ -196,10 +196,10 @@ def main():
196
196
result = run_webwand_task (driver , task_id , task ['ques' ])
197
197
logging .info (f'Task { task_id } status: { result } ' )
198
198
# Optional: if the previous task timed out, reset the driver after each task to ensure proper state for the next task
199
- # if result == "js-script-timeout":
200
- # driver.quit()
201
- # driver = setup_driver()
202
- # initial_load = True
199
+ if result == "js-script-timeout" :
200
+ driver .quit ()
201
+ driver = setup_driver ()
202
+ initial_load = True
203
203
driver .quit ()
204
204
205
205
if __name__ == "__main__" :
Original file line number Diff line number Diff line change
1
+ import re
2
+
3
+ def process_log_file (log_file_path ):
4
+ with open (log_file_path , 'r' ) as file :
5
+ log_data = file .readlines ()
6
+
7
+ task_status_pattern = re .compile (r"Task ([\w\s-]+--\d+) status: (script-error|success|fail|doc-unload-max-retry|js-script-timeout|webdriver-error|python-script-error)" )
8
+ tasks = []
9
+
10
+ for line in log_data :
11
+ match = task_status_pattern .search (line )
12
+ if match :
13
+ task_id = match .group (1 )
14
+ status = match .group (2 )
15
+ tasks .append ((task_id , status ))
16
+
17
+ return tasks
18
+
19
+ def write_task_status (tasks ):
20
+ header = "Task_id\t Task_status"
21
+ rows = [f"{ task_id } \t { status } " for task_id , status in tasks ]
22
+ return header + "\n " + "\n " .join (rows )
23
+
24
+ log_file_path = 'webwand_test_log.txt'
25
+ tasks = process_log_file (log_file_path )
26
+ formatted_output = write_task_status (tasks )
27
+
28
+ output_file_path = 'tasks_status.txt'
29
+ with open (output_file_path , 'w' ) as output_file :
30
+ output_file .write (formatted_output )
31
+
32
+ print (f"Tasks results are saved to { output_file_path } " )
You can’t perform that action at this time.
0 commit comments