Commit 1df6056d authored by Jerome Berthier's avatar Jerome Berthier Committed by Romain Bignon

[cmes] backport ActionNeeded handling from the old browser to the new CMES browser

parent 548e7c58
......@@ -21,7 +21,7 @@
from weboob.browser import LoginBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword
from .pages import (
LoginPage, NewAccountsPage, OperationsListPage, OperationPage,
LoginPage, NewAccountsPage, OperationsListPage, OperationPage, ActionNeededPage,
......@@ -30,6 +30,10 @@ class CmesBrowserNew(LoginBrowser):
login = URL('r(?P<client_space>.*)fr/identification/authentification.html', LoginPage)
action_needed = URL('(?P<subsite>.*)(?P<client_space>.*)fr/epargnants/premiers-pas/saisir-vos-coordonnees.*',
accounts = URL(r'(?P<subsite>.*)(?P<client_space>.*)fr/epargnants/mon-epargne/situation-financiere-detaillee/index.html',
......@@ -25,8 +25,10 @@ from weboob.browser.elements import ListElement, ItemElement, method
from weboob.browser.filters.standard import (
CleanText, CleanDecimal, Date, Regexp, Field, Currency, Upper, MapIn, Eval
from weboob.browser.filters.html import Link
from import Account, Investment, Pocket, NotAvailable
from import FrenchTransaction
from weboob.exceptions import ActionNeeded
class Transaction(FrenchTransaction):
......@@ -50,6 +52,28 @@ class LoginPage(HTMLPage):
class ActionNeededPage(HTMLPage, LoggedPage):
def on_load(self):
# Need to update mail. Try to skip
msg = "Merci de renseigner votre adresse e-mail"
if CleanText('//p[@role="heading" and contains(text(), "%s")]' % msg)(self.doc):
url = Link('//a[contains(., "PASSER CETTE ETAPE")]')(self.doc)
if url:
raise ActionNeeded(msg)
# Mobile phone update can not be skipped
msg = "Merci de renseigner votre numéro de téléphone mobile"
if CleanText('//p[@role="heading" and contains(text(), "%s")]' % msg)(self.doc):
raise ActionNeeded(msg)
# CGU, can not bypass
msg = "Veuillez accepter les conditions générales d'utilisation"
if CleanText('//p[@role="heading" and contains(text(), "%s")]' % msg)(self.doc):
raise ActionNeeded(msg)
"pargne entreprise": Account.TYPE_PEE,
"pargne retraite": Account.TYPE_PERCO
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment