From d028e803bc1da5795e6a1e96078f0690984864f0 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Mon, 24 Dec 2012 13:32:43 +0100 Subject: [PATCH] fix crash when there is no operation on an account --- modules/ing/pages/account_history.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/ing/pages/account_history.py b/modules/ing/pages/account_history.py index 7875fdea..897a4cb5 100644 --- a/modules/ing/pages/account_history.py +++ b/modules/ing/pages/account_history.py @@ -45,7 +45,11 @@ class AccountHistory(BasePage): pass def get_transactions(self): - table = self.document.findall('//tbody')[0] + try: + table = self.document.findall('//tbody')[0] + except IndexError: + return + for tr in table.xpath('tr'): textdate = tr.find('td[@class="op_date"]').text_content() textraw = tr.find('td[@class="op_label"]').text_content().strip() @@ -66,6 +70,9 @@ class AccountHistory(BasePage): def islast(self): form = self.document.find('//form[@id="navigation_form"]') + if form is None: + return True + alinks = form.xpath('div/a') for a in alinks: if u'Page Suivante' in a.text: