diff --git a/modules/fortuneo/browser.py b/modules/fortuneo/browser.py index d56179ed..a9639d27 100644 --- a/modules/fortuneo/browser.py +++ b/modules/fortuneo/browser.py @@ -79,8 +79,7 @@ class Fortuneo(BaseBrowser): self.location('/ReloadContext?action=1&') def get_history(self, account): - if not self.is_on_page(AccountHistoryPage): - self.location(account._link_id) + self.location(account._link_id) return self.page.get_operations(account) def get_accounts_list(self): diff --git a/modules/fortuneo/pages/accounts_list.py b/modules/fortuneo/pages/accounts_list.py index 6f63a77f..87092226 100644 --- a/modules/fortuneo/pages/accounts_list.py +++ b/modules/fortuneo/pages/accounts_list.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . + +from lxml.html import etree from decimal import Decimal import re import datetime @@ -25,6 +27,7 @@ from weboob.capabilities.bank import Account from weboob.tools.browser import BasePage, BrowserIncorrectPassword from weboob.capabilities import NotAvailable from weboob.tools.capabilities.bank.transactions import FrenchTransaction +from weboob.tools.json import json __all__ = ['GlobalAccountsList', 'AccountsList', 'AccountHistoryPage'] @@ -90,6 +93,30 @@ class AccountsList(BasePage): if len(warn) > 0: raise BrowserIncorrectPassword(warn[0].text) + # load content of loading divs. + divs = [] + for div in self.document.xpath('//div[starts-with(@id, "as_")]'): + loading = div.xpath('.//span[@class="loading"]') + if len(loading) == 0: + continue + + input = div.xpath('.//input')[0] + divs.append([div, input.attrib['name']]) + + if len(divs) > 0: + args = {} + for i, (div, name) in enumerate(divs): + args['key%s' % i] = name + args['div%s' % i] = div.attrib['id'] + args['time'] = 0 + r = self.browser.openurl(self.browser.buildurl('/AsynchAjax', **args)) + data = json.load(r) + + for i, (div, name) in enumerate(divs): + html = data['data'][i]['flux'] + div.clear() + div.insert(0, etree.fromstring(html, parser=etree.HTMLParser())) + def need_reload(self): form = self.document.xpath('//form[@name="InformationsPersonnellesForm"]') return len(form) > 0