diff --git a/modules/bp/browser.py b/modules/bp/browser.py index 794e37754df4c042747d395b26ccd26318eb146e..adaef9fb216dc2e48db20ac18ec87b5f8306652f 100644 --- a/modules/bp/browser.py +++ b/modules/bp/browser.py @@ -62,7 +62,7 @@ from .pages.accountlist import ( MarketLoginPage, UselessPage, ProfilePage, MarketCheckPage, MarketHomePage, ) -from .pages.pro import RedirectPage, ProAccountsList, ProAccountHistory, DownloadRib, RibPage +from .pages.pro import RedirectPage, ProAccountsList, ProAccountHistory, DownloadRib, RibPage, RedirectAfterVKPage from .pages.mandate import MandateAccountsList, PreMandate, PreMandateBis, MandateLife, MandateMarket from .linebourse_browser import LinebourseAPIBrowser @@ -1027,6 +1027,15 @@ def iter_emitters(self): class BProBrowser(BPBrowser): login_url = "https://banqueenligne.entreprises.labanquepostale.fr/wsost/OstBrokerWeb/loginform?TAM_OP=login&ERROR_CODE=0x00000000&URL=%2Fws_q47%2Fvoscomptes%2Fidentification%2Fidentification.ea%3Forigin%3Dprofessionnels" + + # Landing page after virtual keyboard. The response is a redirection to + # switch_q5c only if an SCA is activated (TODO: check), and just a standard + # page for connections without SCA + redirect_after_vk = URL( + r'.*voscomptes/identification/identification.ea.*', + RedirectAfterVKPage + ) + accounts_and_loans_url = None pro_accounts_list = URL(r'.*voscomptes/synthese/synthese.ea', ProAccountsList) @@ -1052,6 +1061,14 @@ class BProBrowser(BPBrowser): DownloadPage ) + # Redefined from BPBrowser.redirect_page because + # 'voscomptes/identification/identification.ea' is an expected page and + # we shouldn't raise a BrowserUnavailable, at least for pro website + redirect_page = URL( + r'.*voscomptes/synthese/3-synthese.ea', + RedirectPage + ) + BASEURL = 'https://banqueenligne.entreprises.labanquepostale.fr' def set_variables(self): diff --git a/modules/bp/pages/pro.py b/modules/bp/pages/pro.py index 16d9d4eb8a12ddbdf2102e48aab365497485eadf..b6975e9d16dde58484612f3df587765038069991 100644 --- a/modules/bp/pages/pro.py +++ b/modules/bp/pages/pro.py @@ -157,3 +157,7 @@ class get_profile(ItemElement): obj_name = CleanText('//table[@class="datalistecart"]//td[@class="nom"]') obj_address = CleanText('//table[@class="datalistecart"]//td[@class="adr"]') + + +class RedirectAfterVKPage(MyHTMLPage): + pass