#545 refactored select city from zip (#546)

This commit is contained in:
Heavenfighter
2025-06-10 14:47:02 +02:00
committed by GitHub
parent 92ac17b430
commit a5603e742f

View File

@@ -744,9 +744,8 @@ class KleinanzeigenBot(WebScrapingMixin):
await self.web_sleep(1) # Wait for city dropdown to populate await self.web_sleep(1) # Wait for city dropdown to populate
options = await self.web_find_all(By.CSS_SELECTOR, "#pstad-citychsr option") options = await self.web_find_all(By.CSS_SELECTOR, "#pstad-citychsr option")
for option in options: for option in options:
option_text = await self.web_text(By.CSS_SELECTOR, "option", parent = option) if option.text == ad_cfg.contact.location:
if option_text == ad_cfg.contact.location: await self.web_select(By.ID, "pstad-citychsr", option.attrs.value)
await self.web_select(By.ID, "pstad-citychsr", option_text)
break break
except TimeoutError: except TimeoutError:
LOG.debug("Could not set city from location") LOG.debug("Could not set city from location")