Commit 9025264e authored by Jerome Berthier's avatar Jerome Berthier Committed by ntome

[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.
parent 12903258
......@@ -231,6 +231,15 @@ class BanquePopulaire(LoginBrowser):
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):
......
......@@ -630,6 +630,7 @@ class AccountsPage(LoggedPage, MyHTMLPage):
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)
......
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