fix: Update css class selectors fixing #440 (#441)

* fixes #440 css update
* fixed class selector
* added missing translation
---------

Co-authored-by: Jens Bergmann <1742418+1cu@users.noreply.github.com>
This commit is contained in:
NME
2025-02-28 17:16:49 +01:00
committed by GitHub
parent b99be81158
commit 7b9412677e
2 changed files with 11 additions and 5 deletions

View File

@@ -887,8 +887,8 @@ class KleinanzeigenBot(WebScrapingMixin):
except TimeoutError as ex: except TimeoutError as ex:
LOG.debug(ex, exc_info = True) LOG.debug(ex, exc_info = True)
elif ad_cfg["shipping_options"]: elif ad_cfg["shipping_options"]:
await self.web_click(By.XPATH, '//*[contains(@class, "ShippingSection")]//*//button[contains(@class, "SelectionButton")]') await self.web_click(By.XPATH, '//*[contains(@class, "SubSection")]//*//button[contains(@class, "SelectionButton")]')
await self.web_click(By.CSS_SELECTOR, '[class*="CarrierSelectionModal--Button"]') await self.web_click(By.CSS_SELECTOR, '[class*="CarrierSelectionModal"]')
await self.__set_shipping_options(ad_cfg) await self.__set_shipping_options(ad_cfg)
else: else:
try: try:
@@ -899,8 +899,8 @@ class KleinanzeigenBot(WebScrapingMixin):
await self.web_select(By.XPATH, special_shipping_selector, shipping_value) await self.web_select(By.XPATH, special_shipping_selector, shipping_value)
else: else:
await self.web_click(By.XPATH, await self.web_click(By.XPATH,
'//*[contains(@class, "ShippingSection")]//*//button[contains(@class, "SelectionButton")]') '//*[contains(@class, "SubSection")]//*//button[contains(@class, "SelectionButton")]')
await self.web_click(By.CSS_SELECTOR, '[class*="CarrierSelectionModal--Button"]') await self.web_click(By.CSS_SELECTOR, '[class*="CarrierSelectionModal"]')
await self.web_click(By.CSS_SELECTOR, '[class*="CarrierOption--Main"]') await self.web_click(By.CSS_SELECTOR, '[class*="CarrierOption--Main"]')
if ad_cfg["shipping_costs"]: if ad_cfg["shipping_costs"]:
await self.web_input(By.CSS_SELECTOR, '.IndividualShippingInput input[type="text"]', str.replace(ad_cfg["shipping_costs"], ".", ",") await self.web_input(By.CSS_SELECTOR, '.IndividualShippingInput input[type="text"]', str.replace(ad_cfg["shipping_costs"], ".", ",")
@@ -966,9 +966,13 @@ class KleinanzeigenBot(WebScrapingMixin):
except TimeoutError as ex: except TimeoutError as ex:
LOG.debug(ex, exc_info = True) LOG.debug(ex, exc_info = True)
await self.web_click(By.XPATH, '//*[contains(@class, "ModalDialog--Actions")]//button[.//*[text()[contains(.,"Fertig")]]]')
except TimeoutError as ex: except TimeoutError as ex:
LOG.debug(ex, exc_info = True) LOG.debug(ex, exc_info = True)
try:
# Click apply button
await self.web_click(By.XPATH, '//*[contains(@class, "ModalDialog--Actions")]//button[.//*[text()[contains(.,"Bestätigen")]]]')
except TimeoutError as ex:
raise TimeoutError(_("Unable to close shipping dialog!")) from ex
async def __upload_images(self, ad_cfg: dict[str, Any]) -> None: async def __upload_images(self, ad_cfg: dict[str, Any]) -> None:
LOG.info(" -> found %s", pluralize("image", ad_cfg["images"])) LOG.info(" -> found %s", pluralize("image", ad_cfg["images"]))

View File

@@ -137,6 +137,8 @@ kleinanzeigen_bot/__init__.py:
fill_login_data_and_send: fill_login_data_and_send:
"Logging in as [%s]...": "Anmeldung als [%s]..." "Logging in as [%s]...": "Anmeldung als [%s]..."
__set_shipping_options:
"Unable to close shipping dialog!": "Versanddialog konnte nicht geschlossen werden!"
################################################# #################################################
kleinanzeigen_bot/extract.py: kleinanzeigen_bot/extract.py: