Skip to content

Commit a348a30

Browse files
fix: changes for-loop to while-loop
1 parent 071076c commit a348a30

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

webqa_agent/testers/case_gen/agents/execute_agent.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,13 +574,16 @@ def extract_path(u):
574574
)
575575
]
576576
final_summary = "No summary provided."
577-
total_steps = len(case.get("steps", []))
577+
case_steps = case.get("steps", []) # Get reference to steps list
578+
total_steps = len(case_steps)
578579
failed_steps = [] # Track failed steps for summary generation
579580
case_modified = False # Track if case was modified with dynamic steps
580581
dynamic_generation_count = 0 # Track how many times dynamic generation occurred
581582
dom_diff_cache = []
582583

583-
for i, step in enumerate(case.get("steps", [])):
584+
i = 0
585+
while i < len(case_steps):
586+
step = case_steps[i]
584587
instruction_to_execute = step.get("action") or step.get("verify")
585588
step_type = "Action" if step.get("action") else "Assertion"
586589

@@ -841,6 +844,9 @@ def is_similar_step(step1: dict, step2: dict) -> bool:
841844
failed_steps.append(i + 1)
842845
final_summary = f"FINAL_SUMMARY: Step '{instruction_to_execute}' raised an exception: {str(e)}"
843846
break
847+
848+
# Move to next step
849+
i += 1
844850

845851
# If the loop finishes without an early exit, generate a final summary
846852
if "FINAL_SUMMARY:" not in final_summary:

0 commit comments

Comments
 (0)