Skip to content

[KOB-53267] fix(python proxy): inject element id into empty click bodies#64

Open
mimosa767 wants to merge 1 commit into
kobiton:masterfrom
mimosa767:fix/kob-53267-python-click-body-injection
Open

[KOB-53267] fix(python proxy): inject element id into empty click bodies#64
mimosa767 wants to merge 1 commit into
kobiton:masterfrom
mimosa767:fix/kob-53267-python-click-body-injection

Conversation

@mimosa767

@mimosa767 mimosa767 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Appium-Python-Client 3.x's element.click() sends POST .../element/{eid}/click with body {}. Java's MobileElement.click() sends {"id":"<eid>"}. Kobiton's flex-correct matches live commands against the baseline by the legacy id-in-body click shape, so Python's empty body breaks the match — flex-correct can't replay the dropped intermediate commands from KOB-53091, Save Expense fires on an empty form, and the test fails at the next UI step.
  • Fix intercepts POST .../element/<eid>/click in ProxyServer.serve() and rewrites empty {} bodies to {"id":"<eid>"} (extracting eid from the URL path). Java-shape bodies pass through unchanged.
  • Closes KOB-53267.

Verification

All runs on baseline session 8671449, Pixel 8 Pro / Android 16, kobiton:flexCorrect=true, no live-view portal-watching:

Run Session type click body Result Time
Java (control) 8671457 AUTO {"id":"…"} ✅ PASS 17 s
Python pre-fix 8672218 AUTO {} ❌ FAIL @ Open Menu 135 s
Python with this patch 8672365 AUTO {"id":"…"} ✅ PASS 19 s

Python now performs identically to Java end-to-end on the same baseline.

Test plan

  • Verified the patched proxy rewrites the wire body to {"id":"<eid>"} via session 8672365's Appium log
  • End-to-end pytest run passes on a fresh export of baseline 8671449
  • Non-click endpoints (/elements, /timeouts, /context, /source, /screenshot, etc.) are unaffected — patch only triggers on POST .../element/<eid>/click
  • Java-shape click bodies (already containing id) pass through unchanged

Notes

  • See KOB-53267 for the full investigation trail. Earlier theories (W3C alwaysMatch leak, MIXED session classification) were ruled out in the comment history — actual cause is the click body shape mismatch.
  • Long-term, server-side fix on Kobiton flex-correct's command matcher to accept both {} and {"id":"…"} would be the most correct fix — this PR is the contained workaround that ships today and unblocks generated Python pytest exports.

🤖 Generated with Claude Code

Appium-Python-Client 3.x's `element.click()` sends `POST .../element/{eid}/click`
with body `{}`. Java's `MobileElement.click()` sends `{"id":"<eid>"}`.
Kobiton's flex-correct matches live commands against the baseline by the
legacy id-in-body click shape, so Python's empty body breaks the match and
the dropped intermediate commands from KOB-53091 never get replayed
server-side. Save Expense fires on an empty form, the form stays on screen,
and the next UI step can't be found -- every Python pytest export of a
recording that depends on flex-correct fails at the first form-submit.

Intercept `POST .../element/<eid>/click` in `ProxyServer.serve()` and rewrite
empty `{}` bodies to `{"id":"<eid>"}` (eid extracted from the URL path).
Java-shape bodies pass through unchanged.

Verified on baseline session 8671449 (Pixel 8 Pro / Android 16, flex=true):
- Without patch: FAIL @ Open Menu, 135s (session 8672218)
- With patch:   PASS,              19s (session 8672365)
Matches Java's 17s pass time.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 29, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant