mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 18:41:50 +01:00
feat: Allow individual shipping without setting shipping costs (#626)
This commit is contained in:
@@ -1112,29 +1112,28 @@ class KleinanzeigenBot(WebScrapingMixin):
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
# no options. only costs. Set custom shipping cost
|
# no options. only costs. Set custom shipping cost
|
||||||
if ad_cfg.shipping_costs is not None:
|
await self.web_click(By.XPATH,
|
||||||
|
'//button//span[contains(., "Versandmethoden auswählen")]')
|
||||||
|
try:
|
||||||
|
# when "Andere Versandmethoden" is not available, then we are already on the individual page
|
||||||
await self.web_click(By.XPATH,
|
await self.web_click(By.XPATH,
|
||||||
'//button//span[contains(., "Versandmethoden auswählen")]')
|
'//dialog//button[contains(., "Andere Versandmethoden")]')
|
||||||
|
except TimeoutError:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# when "Andere Versandmethoden" is not available, then we are already on the individual page
|
# only click on "Individueller Versand" when "IndividualShippingInput" is not available, otherwise its already checked
|
||||||
await self.web_click(By.XPATH,
|
# (important for mode = UPDATE)
|
||||||
'//dialog//button[contains(., "Andere Versandmethoden")]')
|
await self.web_find(By.XPATH,
|
||||||
except TimeoutError:
|
'//input[contains(@placeholder, "Versandkosten (optional)")]',
|
||||||
pass
|
timeout = 2)
|
||||||
|
except TimeoutError:
|
||||||
try:
|
await self.web_click(By.XPATH, '//*[contains(@id, "INDIVIDUAL") and contains(@data-testid, "Individueller Versand")]')
|
||||||
# only click on "Individueller Versand" when "IndividualShippingInput" is not available, otherwise its already checked
|
|
||||||
# (important for mode = UPDATE)
|
|
||||||
await self.web_find(By.XPATH,
|
|
||||||
'//input[contains(@placeholder, "Versandkosten (optional)")]',
|
|
||||||
timeout = 2)
|
|
||||||
except TimeoutError:
|
|
||||||
await self.web_click(By.XPATH, '//*[contains(@id, "INDIVIDUAL") and contains(@data-testid, "Individueller Versand")]')
|
|
||||||
|
|
||||||
|
if ad_cfg.shipping_costs is not None:
|
||||||
await self.web_input(By.XPATH, '//input[contains(@placeholder, "Versandkosten (optional)")]',
|
await self.web_input(By.XPATH, '//input[contains(@placeholder, "Versandkosten (optional)")]',
|
||||||
str.replace(str(ad_cfg.shipping_costs), ".", ","))
|
str.replace(str(ad_cfg.shipping_costs), ".", ","))
|
||||||
await self.web_click(By.XPATH, '//dialog//button[contains(., "Fertig")]')
|
await self.web_click(By.XPATH, '//dialog//button[contains(., "Fertig")]')
|
||||||
except TimeoutError as ex:
|
except TimeoutError as ex:
|
||||||
LOG.debug(ex, exc_info = True)
|
LOG.debug(ex, exc_info = True)
|
||||||
raise TimeoutError(_("Unable to close shipping dialog!")) from ex
|
raise TimeoutError(_("Unable to close shipping dialog!")) from ex
|
||||||
|
|||||||
Reference in New Issue
Block a user