mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-16 12:21:50 +01:00
## Problem `web_check()` delegates to `web_find()`, which raises `TimeoutError` when an element does not exist in the DOM at all — not just when it is hidden. The `versand_s` `<select>` element was removed from the ad posting form for non-commercial (private) accounts on kleinanzeigen.de, causing all ads with `shipping_type=SHIPPING` and no explicit `shipping_options` to fail with: ``` TimeoutError: No HTML element found using XPath '//select[contains(@id, ".versand_s")]' within N seconds. ``` This affects the `else` branch in `__set_shipping()` where `web_check(By.XPATH, special_shipping_selector, Is.DISPLAYED)` is called without handling the case where the element is entirely absent. ## Fix - Wrap the commercial-account `versand_s` check in `try/except TimeoutError` so that non-commercial accounts (where the element no longer exists) gracefully fall through to the dialog-based shipping flow. - Use `short_timeout` (quick_dom) instead of the default timeout to avoid waiting the full timeout duration for an element that will never appear. ## Test plan - [ ] Publish an ad with `shipping_type: SHIPPING` and no `shipping_options` from a private (non-commercial) account - [ ] Verify the bot correctly falls through to the "Versandmethoden auswählen" dialog - [ ] Verify commercial accounts with the `versand_s` dropdown still work as before <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved shipping selection flow with a guarded probe and reliable fallback so non-commercial accounts and UI variants continue to work when certain elements are absent. * **Tests** * Added unit tests covering shipping selector timeout/fallback behavior and URL construction to prevent regressions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Liermann Torsten - Hays <liermann.hays@partner.akdb.de> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
104 KiB
104 KiB