Skip to content

Commit

Permalink
Add support for the new Website
Browse files Browse the repository at this point in the history
  • Loading branch information
s0nik42 committed Jan 6, 2025
1 parent 97f0175 commit ab5b92d
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions veolia-idf-domoticz.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,14 +686,14 @@ def get_file(self):
self.wait_until_disappeared(By.CSS_SELECTOR, "lightning-spinner")
time.sleep(1)

### COMPORTEMENT DIFFERENT S'IL S AGIT D'UN MULTU CONTRATS
### COMPORTEMENT DIFFERENT S'IL S AGIT D'UN MULTI CONTRATS
### OU D'UN CONTRAT UNIQUE (CLICK DIRECTEMENT SUR HISTORIQUE)

self.print("Wait for MENU contrats or historique", end="")
ep = EC.visibility_of_element_located(
(
By.XPATH,
"//span[contains(text(), 'CONTRATS') or contains(text(), 'HISTORIQUE')]",
"//span[contains(text(), 'Contrats') or contains(text(), 'Historique')]",
)
)
el = self.__wait.until(
Expand All @@ -716,13 +716,14 @@ def get_file(self):
self.print(st="ok")

# GESTION DU PARCOURS MULTICONTRATS
if menu_type == "CONTRATS":
if menu_type == "Contrats":
time.sleep(2)
self.click_in_view(
By.LINK_TEXT,
str(self.configuration["veolia_contract"]),
wait_message="Select contract : %s"
% (str(self.configuration["veolia_contract"]),),
By.XPATH,
r"//div[@class='fra-contrat-table-row']//span[contains(@class, 'link')]/a[text()='"
+ str(self.configuration["veolia_contract"])
+ r"']",
wait_message="Select contract : %s" % (str(self.configuration["veolia_contract"]),),
click_message="Click on contract",
delay=0,
)
Expand All @@ -731,8 +732,9 @@ def get_file(self):

###### Click Historique #####
self.click_in_view(
By.LINK_TEXT,
"Historique",
By.XPATH,
r"//*[(self::a and text()='Historique')"
r" or (self::span and contains(text(), 'Historique'))]",
wait_message="Wait for historique menu",
click_message="Click on historique menu",
delay=4,
Expand Down Expand Up @@ -1073,7 +1075,7 @@ def update_device(self, csv_file):
# Verify data integrity :
d1 = datetime.strptime(date, "%Y-%m-%d")
d2 = datetime.now()
if abs((d2 - d1).days) > 300:
if abs((d2 - d1).days) > 30:
raise RuntimeError(
"File contains too old data (monthly?!?): "
+ str(row)
Expand Down

0 comments on commit ab5b92d

Please sign in to comment.