diff --git a/modules/boursorama/browser.py b/modules/boursorama/browser.py index c1a4afe542328c7b9eea0a25927cfbd2862b5370..9fee667a614d5ead9ec4f01f1fa50bbaaefd8463 100644 --- a/modules/boursorama/browser.py +++ b/modules/boursorama/browser.py @@ -55,7 +55,7 @@ TransferAccounts, TransferRecipients, TransferCharacteristics, TransferConfirm, TransferSent, AddRecipientPage, StatusPage, CardHistoryPage, CardCalendarPage, CurrencyListPage, CurrencyConvertPage, AccountsErrorPage, NoAccountPage, TransferMainPage, PasswordPage, NewTransferWizard, - NewTransferConfirm, NewTransferSent, CardSumDetailPage, + NewTransferConfirm, NewTransferSent, CardSumDetailPage, MinorPage, ) from .transfer_pages import TransferListPage, TransferInfoPage @@ -84,7 +84,7 @@ class BoursoramaBrowser(RetryLoginBrowser, TwoFactorBrowser): ErrorPage ) login = URL(r'/connexion/saisie-mot-de-passe', PasswordPage) - + minor = URL(r'/connexion/mineur', MinorPage) accounts = URL(r'/dashboard/comptes\?_hinclude=300000', AccountsPage) accounts_error = URL(r'/dashboard/comptes\?_hinclude=300000', AccountsErrorPage) pro_accounts = URL(r'/dashboard/comptes-professionnels\?_hinclude=1', AccountsPage) @@ -263,7 +263,9 @@ def init_login(self): self.login.go() self.page.enter_password(self.username, self.password) - if self.error.is_here(): + if self.minor.is_here(): + raise NoAccountsException(self.page.get_error_message()) + elif self.error.is_here(): raise BrowserIncorrectPassword() elif self.login.is_here(): error = self.page.get_error() diff --git a/modules/boursorama/pages.py b/modules/boursorama/pages.py index 06e4b16605e10a6dc4a53c6d3c7e8f92d931cb95..6dcf5499d81080a8afea1c4f1eec7faca9741760 100644 --- a/modules/boursorama/pages.py +++ b/modules/boursorama/pages.py @@ -1111,6 +1111,11 @@ def on_load(self): raise ActionNeeded(error) +class MinorPage(HTMLPage): + def get_error_message(self): + return CleanText('//div[@id="modal-main-content"]//p')(self.doc) + + class ExpertPage(LoggedPage, HTMLPage): pass