From e590a32aa243ac7823172aa08dc8bddf8cc55282 Mon Sep 17 00:00:00 2001 From: Heavenfighter <33938595+Heavenfighter@users.noreply.github.com> Date: Thu, 9 Jan 2025 17:00:51 +0100 Subject: [PATCH] fix: re-publishing without images #371 (#372) added detection of image-question --- src/kleinanzeigen_bot/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/kleinanzeigen_bot/__init__.py b/src/kleinanzeigen_bot/__init__.py index be56b19..169afb5 100644 --- a/src/kleinanzeigen_bot/__init__.py +++ b/src/kleinanzeigen_bot/__init__.py @@ -729,6 +729,11 @@ class KleinanzeigenBot(WebScrapingMixin): await self.web_click(By.XPATH, "//fieldset[@id='postad-publish']//*[contains(text(),'Anzeige aufgeben')]") await self.web_click(By.ID, "imprint-guidance-submit") + # check for no image question + image_hint_xpath = '//*[contains(@class, "ModalDialog--Actions")]//button[.//*[text()[contains(.,"Ohne Bild veröffentlichen")]]]' + if not ad_cfg["images"] and await self.web_check(By.XPATH, image_hint_xpath, Is.DISPLAYED): + await self.web_click(By.XPATH, image_hint_xpath) + await self.web_await(lambda: "p-anzeige-aufgeben-bestaetigung.html?adId=" in self.page.url, timeout = 20) ad_cfg_orig["updated_on"] = datetime.utcnow().isoformat()