Files
kleinanzeigen-bot/tests
Jens ce0c5fa5b5 fix: handle DOM retry and button combobox selection (#1186)
## ℹ️ Description

- Link to the related issue(s): Issue #1184
- Fixes two publish-flow failures reported in issue #1184:
- persistent nodriver `ProtocolException(code=-32601)` could spin
forever in `web_await()` while repeatedly re-attaching the CDP session;
- special-attribute button comboboxes in the Handy & Telefon category
needed open/read/select to happen atomically in one browser execution.

## 📋 Changes Summary

- Bound `web_await()` CDP reattach retries by the configured timeout and
add a short nonzero retry delay to avoid event-loop starvation.
- Update special-attribute button-combobox selection to use one async
`web_execute()` script that opens via pointer/mouse events, discovers
options, matches API values, and clicks the selected option before the
dropdown can close.
- Add regression tests for bounded `-32601` retry behavior and atomic
button-combobox selection.
- Update the German translation for the enhanced combobox failure
message.
- Verified with the live `button-combobox` DOM probe.

### ⚙️ Type of Change

Select the type(s) of change(s) included in this pull request:
- [x] 🐞 Bug fix (non-breaking change which fixes an issue)
- [ ]  New feature (adds new functionality without breaking existing
usage)
- [ ] 💥 Breaking change (changes that might break existing user setups,
scripts, or configurations)


##  Checklist

Before requesting a review, confirm the following:
- [x] I have reviewed my changes to ensure they meet the project's
standards.
- [x] I have tested my changes and ensured that all tests pass (`pdm run
test`).
- [x] I have formatted the code (`pdm run format`).
- [x] I have verified that linting passes (`pdm run lint`).
- [x] I have updated documentation where necessary.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

## Validation

- `pdm run format`
- `pdm run lint`
- `pdm run test` — 1370 passed, 4 skipped
- `pdm run python data/verify_dom_assumptions.py run --yes --probe
button-combobox --report
data/.temp/dom-assumptions-issue-1184-button-combobox.json` — passed


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Improved dropdown/combobox option selection with stronger matching and
more informative timeout/error reporting.
* Tightened CDP re-attach retry logic to strictly follow the remaining
timeout budget.
* Added a startup runtime warning if the required nodriver CDP re-attach
patch isn’t detected.

* **Documentation / Chores**
* Updated source installation guidance (pip-only users) to ensure the
nodriver patch is applied.
* Made the nodriver fix script marker-based and idempotent, including
normalization of legacy patched installs.

* **Tests**
* Expanded unit tests for combobox selection, re-attach timeout/bounds
behavior, CLI patch warning behavior, and the nodriver fix script.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-06-30 10:39:41 +02:00
..