Skip to content

Commit

Permalink
The Web site has changed some component xpath.
Browse files Browse the repository at this point in the history
  • Loading branch information
ssenart committed Feb 5, 2023
1 parent 624abf7 commit 55c76d0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.1] - 2023-02-05

### Fixed
- The Web site has changed some component xpath.

## [0.2.0] - 2022-10-17

### Added
Expand Down
14 changes: 8 additions & 6 deletions pyveoliaidf/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ def update(self):
# Wait a few for the data page load to complete
time.sleep(5)

# Click on the "Jours" button : //*[@id="options-512"]/div[4]/div/lightning-button-group[2]/slot/c-icl-button-stateful[1]/button
jours_button_element = driver.find_element_by_xpath("//lightning-button-group[2]/slot/c-icl-button-stateful/button", "Historique page: 'Jours' button")
# Click on the "Jours" button.
jours_button_element = driver.find_element_by_xpath("//lightning-button-group[2]/div/slot/c-icl-button-stateful[1]/button", "Historique page: 'Jours' button")
jours_button_element.click()

# Wait a few for some internal refreshes.
time.sleep(10)

# Click on the "Litres" button : //*[@id="options-415"]/div[4]/div/lightning-button-group[3]/slot/c-icl-button-stateful[2]/button
litres_button_element = driver.find_element_by_xpath("//lightning-button-group[3]/slot/c-icl-button-stateful[2]/button", "Historique page: 'Litres' button")
# Click on the "Litres" button.
litres_button_element = driver.find_element_by_xpath("//lightning-button-group[3]/div/slot/c-icl-button-stateful[2]/button", "Historique page: 'Litres' button")
litres_button_element.click()

# Wait a few for some internal refreshes.
Expand All @@ -106,11 +106,13 @@ def update(self):
startDate = endDate + datetime.timedelta(days=-self.__lastNDays)

# Fill the start date text field.
start_date_element = driver.find_element_by_xpath("//input[@id='input-51']", "Historique page: 'Start date' text field")
start_date_element = driver.find_element_by_xpath("//input[@id='input-52']", "Historique page: 'Start date' text field")
start_date_element.clear()
start_date_element.send_keys(startDate.strftime(dateFormat))

# Fill the end date text field.
end_date_element = driver.find_element_by_xpath("//input[@id='input-55']", "Historique page: 'End date' text field")
end_date_element = driver.find_element_by_xpath("//input[@id='input-56']", "Historique page: 'End date' text field")
end_date_element.clear()
end_date_element.send_keys(endDate.strftime(dateFormat))

# Wait a few for some internal refreshes.
Expand Down

0 comments on commit 55c76d0

Please sign in to comment.