#2519·OpenCLI

[autofix] ctrip/flight: COMMAND_EXEC (DOM drift + short wait + background-window skeleton)

Author: AZALEAFORCreated Sep 17, 2026Updated Sep 17, 2026

Summary

OpenCLI autofix repaired this adapter locally, and the retry passed.

Adapter

  • Site: ctrip
  • Command: flight
  • OpenCLI version: 1.8.6

Original failure

  • Error code: COMMAND_EXEC
Ctrip flight page did not render flight cards (state=timeout)

Local fix summary

Three stacked root causes, diagnosed and verified live on 2026-09-17 (CKG→YCU, 2026-10-01):

1. DOM drift — flight card selector changed. Cards moved from .flight-list > span > div to .flight-list .flight-item (each card now carries data-testid="flight-item-N"). The old selector matches 0 elements, so the wait probe never resolved and the extractor returned nothing. Updated the selector in all three places: the wait probe (WAIT_FOR_FLIGHTS_JS), the scroll helper call (buildScrollUntilJs(...)), and buildFlightExtractJs() in utils.js. The position-anchored innerText parser itself still matches the new DOM chunk order 1:1 — no parser logic change needed. Verified chunk order:

["厦门航空","MF8785","波音737(中)","当日低价","13:40","江北国际机场","T3","15:10","盐湖国际机场","已减¥5","白银贵宾可享","¥","855","起","经济舱","订票"]

2. Wait window too short. Cold-context render takes ~14s (measured live); the hardcoded 8000ms timeout in WAIT_FOR_FLIGHTS_JS fired on every run. Raised to 25000ms.

3. Background window renders skeleton only. With a background window, Ctrip leaves the list as skeleton placeholders (fake-flights / fake-flight-summary / fake-flight-price classes; document.body.innerText.length ≈ 723; 0 .flight-item after a full 25s wait). With a foreground window the real cards render. Pinned defaultWindowMode: 'foreground' in the cli() definition (same approach as clis/mercury/check-login.js).

After the fix, opencli ctrip flight CKG YCU --date 2026-10-01 -f json returns structured rows (e.g. 厦门航空 MF8785 13:40→15:10, ¥855 经济舱).

Issue filed by OpenCLI autofix after a verified local repair.