Commit 9b355e9a authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

s2e/bnpes] Handle unavailable history form

Sometimes the history form to show more transactions is not available
and the module crashes with FormNotFound()

Closes: 16439@sibi
parent cee58456
......@@ -146,9 +146,9 @@ class S2eBrowser(LoginBrowser, StatesMixin):
self.page.go_multi(account._multi)
self.history.go(slug=self.SLUG)
# Get more transactions on each page
self.page.show_more("50")
for tr in self.page.iter_history(accid=account.id):
yield tr
if self.page.show_more("50"):
for tr in self.page.iter_history(accid=account.id):
yield tr
# Go back to first page
self.page.go_start()
......
......@@ -504,7 +504,10 @@ class HistoryPage(LoggedPage, MultiPage):
return form
def show_more(self, nb):
form = self.get_form(self.XPATH_FORM)
try:
form = self.get_form(self.XPATH_FORM)
except FormNotFound:
return False
for select in self.doc.xpath('//select'):
if Attr('./option[@selected]', 'value')(select) == nb:
return
......@@ -513,6 +516,7 @@ class HistoryPage(LoggedPage, MultiPage):
if 'javax.faces.source' not in form:
form['javax.faces.source'] = idt
form.submit()
return True
def go_start(self):
idt = Attr('//a[@title="debut" or @title="precedent"]', 'id', default=None)(self.doc)
......
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