Readding old behaviour of setting price as fallback. Fixes #106

This commit is contained in:
sebthom
2022-09-29 11:27:36 +02:00
parent 41c8264698
commit 12259b4a62

View File

@@ -464,10 +464,16 @@ class KleinanzeigenBot(SeleniumMixin):
#############################
price_type = ad_cfg["price_type"]
if price_type != "NOT_APPLICABLE":
self.web_select(By.XPATH, "//select[@id='price-type-react']", price_type)
if safe_get(ad_cfg, "price"):
self.web_click(By.ID, "post-ad-frontend-price")
self.web_input(By.ID, "post-ad-frontend-price", ad_cfg["price"])
try:
self.web_select(By.XPATH, "//select[@id='price-type-react']", price_type)
if safe_get(ad_cfg, "price"):
self.web_click(By.ID, "post-ad-frontend-price")
self.web_input(By.ID, "post-ad-frontend-price", ad_cfg["price"])
except NoSuchElementException as ex:
# code for old HTML version can be removed at one point in future
self.web_select(By.XPATH, "//select[@id='priceType']", price_type)
if safe_get(ad_cfg, "price"):
self.web_input(By.ID, "pstad-price", ad_cfg["price"])
#############################
# set description