Fixed no element error when shipping type is pickup.

This commit is contained in:
Heavenfighter
2023-12-05 18:49:00 +01:00
committed by Sebastian Thomschke
parent 55d8cc124b
commit 4f76007c7a

View File

@@ -531,11 +531,12 @@ class KleinanzeigenBot(SeleniumMixin):
############################# #############################
sell_directly = ad_cfg["sell_directly"] sell_directly = ad_cfg["sell_directly"]
try: try:
if sell_directly and ad_cfg["shipping_type"] == "SHIPPING" and ad_cfg["shipping_options"] and price_type in {"FIXED", "NEGOTIABLE"}: if ad_cfg["shipping_type"] == "SHIPPING":
if not self.webdriver.find_element(By.ID, "radio-buy-now-yes").is_selected(): if sell_directly and ad_cfg["shipping_options"] and price_type in {"FIXED", "NEGOTIABLE"}:
self.web_click(By.XPATH, '//*[contains(@id, "radio-buy-now-yes")]') if not self.webdriver.find_element(By.ID, "radio-buy-now-yes").is_selected():
elif not self.webdriver.find_element(By.ID, "radio-buy-now-no").is_selected(): self.web_click(By.XPATH, '//*[contains(@id, "radio-buy-now-yes")]')
self.web_click(By.XPATH, '//*[contains(@id, "radio-buy-now-no")]') elif not self.webdriver.find_element(By.ID, "radio-buy-now-no").is_selected():
self.web_click(By.XPATH, '//*[contains(@id, "radio-buy-now-no")]')
except NoSuchElementException as ex: except NoSuchElementException as ex:
LOG.debug(ex, exc_info = True) LOG.debug(ex, exc_info = True)