From 9025264eb7794e6546e026c45f4f28e850b27306 Mon Sep 17 00:00:00 2001 From: Jerome Berthier Date: Wed, 26 Jun 2019 15:19:27 +0200 Subject: [PATCH] [banquepopulaire] fix BrowserUnavailable during iter_accounts The former implementation was not reaching the synthesis page when the accounts list needed to be expanded. In this case, when facing several deferred cards in a row, the browser was not able to perform the prevAction of the 2nd+ card. --- modules/banquepopulaire/browser.py | 9 +++++++++ modules/banquepopulaire/pages.py | 1 + 2 files changed, 10 insertions(+) diff --git a/modules/banquepopulaire/browser.py b/modules/banquepopulaire/browser.py index 7bf7783c79..db272af60d 100644 --- a/modules/banquepopulaire/browser.py +++ b/modules/banquepopulaire/browser.py @@ -231,6 +231,15 @@ def go_on_accounts_list(self): form['token'] = self.page.build_token(form['token']) form.submit() + # In case of prevAction maybe we have reached an expanded accounts list page, need to go back + btn = self.page.doc.xpath('.//button[span[text()="Retour"]]') + if len(btn): + _data = self.page.get_params() + actions = self.page.get_button_actions() + _data.update(actions[btn[0].attrib['id']]) + _data['token'] = self.page.build_token(_data['token']) + self.location('/cyber/internet/ContinueTask.do', data=_data) + @retry(LoggedOut) @need_login def get_accounts_list(self, get_iban=True): diff --git a/modules/banquepopulaire/pages.py b/modules/banquepopulaire/pages.py index f3a18aaeed..9f4f90aa9f 100644 --- a/modules/banquepopulaire/pages.py +++ b/modules/banquepopulaire/pages.py @@ -630,6 +630,7 @@ def iter_accounts(self, next_pages): if len(tds) >= 5 and len(tds[self.COL_COMING].xpath('.//a')) > 0: _params = account._params.copy() _params['dialogActionPerformed'] = 'ENCOURS_COMPTE' + _params['attribute($SEL_$%s)' % tr.attrib['id'].split('_')[0]] = tr.attrib['id'].split('_', 1)[1] # If there is an action needed before going to the cards page, save it. m = re.search('dialogActionPerformed=([\w_]+)', self.url) -- GitLab