Fix #117 NoSuchElementException on price entry

This commit is contained in:
sebthom
2022-10-23 23:13:52 +02:00
parent 84588c7c2e
commit 242308c672

View File

@@ -464,16 +464,9 @@ class KleinanzeigenBot(SeleniumMixin):
############################# #############################
price_type = ad_cfg["price_type"] price_type = ad_cfg["price_type"]
if price_type != "NOT_APPLICABLE": if price_type != "NOT_APPLICABLE":
try: self.web_select(By.XPATH, "//select[@id='price-type-react' or @id='micro-frontend-price-type' or @id='priceType']", price_type)
self.web_select(By.XPATH, "//select[@id='price-type-react']", price_type) if safe_get(ad_cfg, "price"):
if safe_get(ad_cfg, "price"): self.web_input(By.XPATH, "//input[@id='post-ad-frontend-price' or @id='micro-frontend-price' or @id='pstad-price']", 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 # set description