This commit is contained in:
HuangHai
2026-01-31 07:54:15 +08:00
parent 54f1b2fb91
commit cb6ddbb76d
3 changed files with 35 additions and 8 deletions

View File

@@ -74,18 +74,33 @@ def main():
# - Input text
# - Find and click Send button
logger.info("Step 1 & 2: Finding input box and writing text...")
logger.info("Step 1: Finding input box and writing text...")
# We can get a rough position first for logging, though perform_input_action is more robust
screenshot_path = os.path.join(WxUtil.OUTPUT_DIR, "T5_Initial_Check.jpg")
d.screenshot(screenshot_path)
input_pos, _ = WxUtil.find_input_box_center(screenshot_path)
logger.info(f"Initial target input position: {input_pos}")
# We pass debug_prefix="T5" to perform_input_action to get intermediate screenshots
# The function will save:
# - T5_1_check_mode.jpg
# - T5_2_after_mode.jpg
# - T5_3_input_box_found.jpg (if template matched)
# - T5_4_after_input.jpg
# - T5_5_after_send.jpg
# Initial state screenshot
initial_path = os.path.join(WxUtil.OUTPUT_DIR, "T5_0_Initial.jpg")
d.screenshot(initial_path)
logger.info(f"Initial state screenshot saved: {initial_path}")
success = WxUtil.perform_input_action(d, input_pos, test_text, auto_send=True)
# Use a more robust way to find input_pos for logging
input_pos, _ = WxUtil.find_input_box_center(initial_path)
logger.info(f"Target input position (estimated): {input_pos}")
success = WxUtil.perform_input_action(d, input_pos, test_text, auto_send=True, debug_prefix="T5")
if success:
logger.info("✅ Step 3: Send action completed successfully.")
# Final state screenshot
final_path = os.path.join(WxUtil.OUTPUT_DIR, "T5_6_Final.jpg")
d.screenshot(final_path)
logger.info(f"Final state screenshot saved: {final_path}")
else:
logger.error("❌ Send action failed.")