diff --git a/modules/societegenerale/pages/accounts_list.py b/modules/societegenerale/pages/accounts_list.py index 739df3f0897c7774e27f718cc3effb5c855cd4be..6767d563973b05b6565bb720cd6e72a829497719 100644 --- a/modules/societegenerale/pages/accounts_list.py +++ b/modules/societegenerale/pages/accounts_list.py @@ -546,15 +546,28 @@ def get_history_url(self): if history_link: return history_link.group(1) - def iter_history(self): - is_no_transaction_msg = any(( - self.doc.xpath(u'//div[contains(text(), "Aucune opération trouvée sur la période de restitution possible")]'), - self.doc.xpath(u'//div[contains(text(), "Aucune opération n\'a été réalisée depuis le dernier relevé")]'), - )) - assert is_no_transaction_msg, 'There are transactions, retrieve them !' - - # waiting for account with history - return [] + @method + class iter_history(TableElement): + head_xpath = '//table[not(@id)]//td/div[contains(@class, "tableauHead")]' + item_xpath = '//table[@id]//tr' + + def condition(self): + no_transaction_msg = any(( + self.xpath('//div[contains(text(), "Aucune opération trouvée sur la période de restitution possible")]'), + self.xpath('//div[contains(text(), "Aucune opération n\'a été réalisée depuis le dernier relevé")]'), + )) + return not no_transaction_msg + + col_label = 'Libellé' + col_amount = 'Montant' + col_date = 'Date' + + class item(ItemElement): + klass = Transaction + + obj_label = CleanText(TableCell('label')) + obj_amount = CleanDecimal(TableCell('amount')) + obj_date = Date(CleanText(TableCell('date')), dayfirst=True) class LifeInsurance(LoggedPage, HTMLPage):