bd-ic1 Phase 2: iterate Kleinanzeigen contact form, fill from contact_details - #67
Merged
MukhammadIbrokhimov merged 4 commits intoMay 20, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds bd-ic1 Phase 2 structured-field filling for Kleinanzeigen by planning contact-form field operations from the live form HTML and applying them best-effort from profile.contact_details.
Changes:
- Introduces a pure HTML-based planner (
plan_field_fills) that maps Kleinanzeigen form inputs/selects toContactDetailsattributes and emitsFieldPlanoperations. - Wires the planner into
KleinanzeigenFiller.fill()to fill empty structured fields (and keep prefilled/user-entered values intact), continuing on per-field failures. - Adds planner fixtures + unit tests, and extends the Kleinanzeigen filler executor tests with
_FakePage/_Locatorsupport forinner_html,input_value, andselect_option.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/flatpilot/fillers/kleinanzeigen_form.py |
New planner that parses form HTML and emits deterministic fill/select plans. |
src/flatpilot/fillers/kleinanzeigen.py |
Applies planned structured contact-detail fills before the existing message fill. |
tests/test_kleinanzeigen_form_planner.py |
Unit tests validating planner output across full/message-only/no-form fixtures. |
tests/test_filler_kleinanzeigen.py |
Extends Playwright fakes and adds integration-ish tests verifying planner wiring + prefill guard. |
tests/fixtures/kleinanzeigen/contact_form_full.html |
Full contact-form fixture (inputs + selects + message textarea). |
tests/fixtures/kleinanzeigen/contact_form_message_only.html |
Minimal fixture containing only the message textarea. |
.beads/issues.jsonl |
Updates bead status metadata associated with this work. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
191
to
196
|
|
||
| fields_filled: dict[str, str] = {} | ||
|
|
||
| self._apply_contact_details(pg, profile, fields_filled) | ||
|
|
||
| self._fill_required(pg, SELECTORS.message_input, message, label="message") |
Comment on lines
+121
to
+136
| attr = _match_attribute(input_el, scope) | ||
| if attr is None: | ||
| continue | ||
| profile_value = getattr(contact, attr, None) | ||
| if profile_value is None: | ||
| continue | ||
| selector = _selector_for(input_el) | ||
| if input_el.name == "select" and attr in _SELECT_ATTRS: | ||
| label = _select_label_for(input_el, attr, str(profile_value)) | ||
| if label is None: | ||
| continue | ||
| plans.append(FieldPlan(attr=attr, selector=selector, value=label, kind="select")) | ||
| else: | ||
| plans.append( | ||
| FieldPlan(attr=attr, selector=selector, value=str(profile_value), kind="fill") | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/flatpilot/fillers/kleinanzeigen_form.pymaps the form's labels / names / ids toprofile.contact_detailsattributes via a regex map and emits a list ofFieldPlan(attr, selector, value, kind).KleinanzeigenFiller.fill()readsform#viewad-contact-forminner HTML after_reveal_contact_form, runs the planner, and applies each plan viapg.locator(...).fill(...)/.select_option(label=...). Pre-filled fields are respected (empty-check guard); per-field failures are logged and the loop continues._FakePagemock.Real-HTML caveat
The fixtures encode educated guesses about the live form's structure (no empirical capture is in this branch). The planner is intentionally lenient — match across label / name / id — so small DOM shifts should not break it. When a real capture lands, tune
LABEL_MAPregexes andSELECT_OPTION_MAPcandidate strings.Test plan
pytest tests/test_kleinanzeigen_form_planner.py tests/test_filler_kleinanzeigen.py -v— greenpytest -q— full suite green (598 passed)ruff checkon touched files — no errorsCloses FlatPilot-569.