Closed TylonHH closed 3 months ago
same issue, I fixed this issue by fixing the set_shipping_options in init__.py
async def __set_shipping_options(self, ad_cfg: dict[str, Any]) -> None:
try:
shipping_option_mapping = {
"DHL_2": ("Klein", "Paket 2 kg"),
"Hermes_Päckchen": ("Klein", "Päckchen"),
"Hermes_S": ("Klein", "S-Paket"),
"DHL_5": ("Mittel", "Paket 5 kg"),
"Hermes_M": ("Mittel", "M-Paket"),
"DHL_10": ("Mittel", "Paket 10 kg"),
"DHL_31,5": ("Groß", "Paket 31,5 kg"),
"Hermes_L": ("Groß", "L-Paket"),
}
selected_shipping_options = set(ad_cfg["shipping_options"])
try:
mapped_shipping_options = [shipping_option_mapping[option] for option in selected_shipping_options]
selected_shipping_sizes, selected_shipping_packages = zip(*mapped_shipping_options)
except KeyError as ex:
raise KeyError(f"Unknown shipping option(s), please refer to the documentation/README: {ad_cfg['shipping_options']}") from ex
# Determine the unique shipping size (assuming only one size category is allowed)
unique_shipping_sizes = set(selected_shipping_sizes)
if len(unique_shipping_sizes) > 1:
raise ValueError("You can only specify shipping options for one package size!")
shipping_size, = unique_shipping_sizes
await self.web_click(By.CSS_SELECTOR, f'.SingleSelectionItem--Main input[type=radio][data-testid="{shipping_size}"]')
await self.web_sleep()
await self.web_click(
By.XPATH,
'//*[contains(@class, "ModalDialog--Actions")]'
'//*[contains(@class, "Button-primary") and .//*[text()[contains(.,"Weiter")]]]')
await self.web_sleep()
# Get all options that are not selected but are in the same size category
inverted_shipping_packages = [
package for option, (size, package) in shipping_option_mapping.items()
if size == shipping_size and package not in selected_shipping_packages
]
for shipping_package in inverted_shipping_packages:
await self.web_click(
By.XPATH,
'//*[contains(@class, "CarrierSelectionModal")]'
'//*[contains(@class, "CarrierOption")]'
f'//*[contains(@class, "CarrierOption--Main") and @data-testid="{shipping_package}"]'
)
await self.web_sleep()
await self.web_click(By.XPATH, '//*[contains(@class, "ModalDialog--Actions")]//button[.//*[text()[contains(.,"Fertig")]]]')
except TimeoutError as ex:
LOG.debug(ex, exc_info = True)
✔️ Expected Behaviour
Just use the shipping_options wich are listed in the yaml
🐞 Actual Behaviour
all shipping_options are enabled within the ad
📋 Steps to Reproduce
Enable shipping option within an ad, like DHL 5,49€. Export this. Check YAML. Force for renew.
📺 What browsers are you seeing the problem on? (if applicable)
Chrome
💻 What operating systems are you seeing the problem on? (if applicable)
Windows
📃 Relevant log output (if applicable)
Code of Conduct