LCL downloader go back to legacy version

This commit is contained in:
Gabriel Augendre 2022-09-22 20:02:56 +01:00
parent d7a2c10271
commit b831f2be5d

View file

@ -3,6 +3,7 @@ from pathlib import Path
import click import click
from selenium import webdriver from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select from selenium.webdriver.support.select import Select
@ -40,10 +41,10 @@ class LclDownloader:
selenium.get("https://monespace.lcl.fr/connexion") selenium.get("https://monespace.lcl.fr/connexion")
try: try:
self._click(By.ID, "popin_tc_privacy_button_2") self._click(By.ID, "popin_tc_privacy_button_2")
except: click.secho("Accepting privacy policy...")
# If the user has already accepted the privacy policy, except NoSuchElementException:
# the button is not present click.secho("Privacy policy already accepted")
pass
login_input = selenium.find_element(By.ID, "identifier") login_input = selenium.find_element(By.ID, "identifier")
login_input.send_keys(self.config.bank_identifier) login_input.send_keys(self.config.bank_identifier)
self._click(By.CLASS_NAME, "app-cta-button") self._click(By.CLASS_NAME, "app-cta-button")
@ -52,6 +53,12 @@ class LclDownloader:
self._click(By.CLASS_NAME, "app-cta-button") self._click(By.CLASS_NAME, "app-cta-button")
click.secho("Logged in!", fg="green") click.secho("Logged in!", fg="green")
try:
self._click(By.CSS_SELECTOR, ".menu-link.to-legacy")
click.secho("Going back to legacy version...")
except NoSuchElementException:
click.secho("Already on legacy version.")
click.secho("Navigating through archives...", fg="blue") click.secho("Navigating through archives...", fg="blue")
self._click(By.ID, "linkSynthese") self._click(By.ID, "linkSynthese")
self._click(By.CLASS_NAME, "picDl") self._click(By.CLASS_NAME, "picDl")