FIX id of web element to select special attribute changed

This commit is contained in:
Jeppy
2024-07-23 11:11:59 +02:00
committed by Sebastian Thomschke
parent c967e901ac
commit c1272626aa

View File

@@ -718,7 +718,7 @@ class KleinanzeigenBot(WebScrapingMixin):
pass # nosec pass # nosec
try: try:
await self.web_select(By.XPATH, f"//select[@id='{special_attribute_key}']", special_attribute_value) await self.web_select(By.XPATH, f"//select[contains(@id, '{special_attribute_key}')]", special_attribute_value)
except TimeoutError: except TimeoutError:
LOG.debug("Attribute field '%s' is not of kind dropdown, trying to input as plain text...", special_attribute_key) LOG.debug("Attribute field '%s' is not of kind dropdown, trying to input as plain text...", special_attribute_key)
try: try:
@@ -726,7 +726,7 @@ class KleinanzeigenBot(WebScrapingMixin):
except TimeoutError: except TimeoutError:
LOG.debug("Attribute field '%s' is not of kind plain text, trying to input as radio button...", special_attribute_key) LOG.debug("Attribute field '%s' is not of kind plain text, trying to input as radio button...", special_attribute_key)
try: try:
await self.web_click(By.XPATH, f"//*[@id='{special_attribute_key}']/option[@value='{special_attribute_value}']") await self.web_click(By.XPATH, f"//*[contains(@id, '{special_attribute_key}')]/option[@value='{special_attribute_value}']")
except TimeoutError as ex: except TimeoutError as ex:
LOG.debug("Attribute field '%s' is not of kind radio button.", special_attribute_key) LOG.debug("Attribute field '%s' is not of kind radio button.", special_attribute_key)
raise TimeoutError(f"Failed to set special attribute [{special_attribute_key}]") from ex raise TimeoutError(f"Failed to set special attribute [{special_attribute_key}]") from ex