12306 Android Adb
БесплатноБез исполняемых скриптовНе проверенBook train tickets on the 12306 Android app via USB ADB. Battle-tested 2026-08-30 (two successful bookings: G3314 上海→苏州 and D203 上海松江→杭州南). Primary method…
от openlittlebear1 691 установка в других каталогахОб этом скилле
12306 Train Booking (Android)
12306-specific knowledge, workflows, and pitfalls. The app (com.MobileTicket) uses Alipay Nebula UC WebView for the train list and booking pages, which has unique automation challenges. This doc reflects two successful end-to-end bookings on the current app version (2026-08-30, Realme RMX3350 1080x2400).
🚨 Setup (proven)
Requires the appium-android-adb base skill. It ships ocr_bridge.py — the OCR loop every
command below runs. ClawHub has no dependency resolver, so it will not be installed for you;
install it alongside:
clawhub install appium-android-adb
# venv (one-time, shared with the other *-android-adb skills). The pins ship
# with the base skill — that is the other reason to install it first.
BASE=~/.openclaw/workspace/skills/appium-android-adb # the base skill (ships ocr_bridge.py)
PY=~/.openclaw/workspace/.venv-adb/bin/python
test -f $BASE/ocr_bridge.py || echo "base skill missing — clawhub install appium-android-adb"
python3 -m venv ~/.openclaw/workspace/.venv-adb # no-op if it already exists
$PY -m pip install -r $BASE/requirements-adb.txt
# App must be installed + logged in. If missing, see "Install & Login".
$PY -c "import uiautomator2 as u2; d=u2.connect(); d.app_start('com.MobileTicket')"
Do NOT use the Appium bridge for 12306 on consumer phones — Realme etc. block WRITE_SECURE_SETTINGS, so Appium settings/IME fail and the session never starts. Direct uiautomator2 + OCR works (atx-agent needs no special permission). All interaction goes through the OCR loop: ocr_bridge.py in the appium-android-adb base skill — screenshot → RapidOCR → click/swipe → re-OCR verify.
⚠️ Critical: UC WebView Virtual List Behavior
The train list uses a virtual list inside the UC WebView:
- Accessibility tree / DOM is mostly collapsed (all non-current items share y≈407 or y≈2255, h=6px) and intermittently renders. Never depend on it.
- OCR is the dependable eye: RapidOCR reads Chinese out of the box (no tesseract language packs needed).
- Raw
adb shell input tapis filtered by the WebView.d.click(x, y)(uiautomator2) reliably delivers touches. - The list skips sections when scrolling: a departure-time window (e.g. 06:32) can be jumped over repeatedly.
New-App UI: Card Expansion + Per-Row 预订 (2026-08 version)
Collapsed train cards have NO 预订 button. The flow is:
- Tap the seat row of a card (e.g. "二等" label area) → the card expands in place, showing seat rows: 二等 / 一等 / 商务 / 无座, each with price (e.g.
二等 ¥41 9折). - Each expanded row has its own 预订 button on the right edge (on 1080px width: x≈898–980, h≈48, at the row's y).
- Tap that row's 预订 → 确认订单 page.
BASE=~/.openclaw/workspace/skills/appium-android-adb # the base skill (ships ocr_bridge.py)
PY=~/.openclaw/workspace/.venv-adb/bin/python
# after OCR shows target train card on screen:
$PY $BASE/ocr_bridge.py tap-text 二等 # expand the card
$PY $BASE/ocr_bridge.py tap-text 预订 --y0 <row_top> --y1 <row_bottom> # row's 预订
(Example coordinates from the real run: card row at (141, 2026) expanded; 二等 row 预订 at (939, 1987); order page followed.)
⚠️ Departure-Station Filter — Do This BEFORE Scrolling (一车多站)
Without the filter, the list mixes departures from multiple stations and time order breaks. A train that stops at several departure stations (一车多站, e.g. G7357) appears once per stop-time, all grouped adjacently — so you see 08:10 / 08:35 / 08:52 for the same train number and can't scan by time. Hit this in production (thought "no 08:16 train exists" — there was one).
Fix: tap the departure-station filter chip at the top of the list first (chips row, y≈669-708 on 1080x2400; e.g. 上海松江 / 杭州南 / 上海虹桥 / 上海南):
chip = [x for x in t if '松江' in x[0] and x[2] < 600] # OCR: station name near top
d.click((chip[0][1]+chip[0][3])//2, (chip[0][2]+chip[0][4])//2)
After filtering: one row per train, sorted by departure time, target times are findable by simple scrolling.
⚠️ The filter resets after every re-query (查询车票) — re-apply the chip each time.
Booking Flow (proven end-to-end)
Step 0: Install & Login (only if app missing)
- Download the official APK from the 12306 site (kyfw.12306.cn 下载页), e.g.
curlthe direct link →adb install -r app.apk - The user must log in manually (SMS/face) — automation cannot do this step.
Step 1: Home Page — Stations & Date
Stations: tap the station field → search box opens. Chinese input via clipboard (IME switching is blocked):
BASE=~/.openclaw/workspace/skills/appium-android-adb # the base skill (ships ocr_bridge.py)
PY=~/.openclaw/workspace/.venv-adb/bin/python
$PY $BASE/ocr_bridge.py type 苏州 --x 400 --y 330 # set_clipboard + long-press field
$PY $BASE/ocr_bridge.py dump # find 粘贴 in OCR
$PY $BASE/ocr_bridge.py tap-text 粘贴 # paste → results appear
$PY $BASE/
Установить 12306 Android Adb в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл 12306 Android Adb?
Book train tickets on the 12306 Android app via USB ADB. Battle-tested 2026-08-30 (two successful bookings: G3314 上海→苏州 and D203 上海松江→杭州南). Primary method: direct uiautomator2 + RapidOCR via ocr_bridge.py, shipped by the appium-android-adb base skill (install it alongside — ClawHub has no dependency resolver). Covers the UC WebView virtual-list traps, the card-expand UI, departure-station filter (一车多站 time disorder), scroll-unsticking, clipboard Chinese input, and 车票信息已过期 (M0013) recovery.
Как установить скилл 12306 Android Adb?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл 12306 Android Adb запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic