Support pagination in iter_bills
This commit is contained in:
parent
c34ef464ab
commit
a5e55208ae
3 changed files with 23 additions and 2 deletions
|
|
@ -71,6 +71,8 @@ class IngBrowser(LoginBrowser):
|
|||
self.page.login(self.password)
|
||||
if self.page.error():
|
||||
raise BrowserIncorrectPassword()
|
||||
if self.errorpage.is_here():
|
||||
raise BrowserIncorrectPassword('Please login on website to fill the form and retry')
|
||||
|
||||
@need_login
|
||||
def get_accounts_list(self):
|
||||
|
|
@ -227,7 +229,7 @@ class IngBrowser(LoginBrowser):
|
|||
"transfer_issuer_radio": subscription.id
|
||||
}
|
||||
self.billpage.go(data=data)
|
||||
return self.page.iter_bills(subid=subscription.id)
|
||||
return self.pagination(lambda: self.page.iter_bills(subid=subscription.id))
|
||||
|
||||
def predownload(self, bill):
|
||||
self.page.postpredown(bill._localid)
|
||||
|
|
|
|||
|
|
@ -57,6 +57,26 @@ class BillsPage(LoggedPage, HTMLPage):
|
|||
class iter_bills(ListElement):
|
||||
item_xpath = '//ul[@id="statements_form:statementsel"]/li'
|
||||
|
||||
def next_page(self):
|
||||
lis = self.page.doc.xpath('//form[@name="years_form"]//li')
|
||||
selected = False
|
||||
ref = None
|
||||
for li in lis:
|
||||
if "rich-list-item selected" in li.attrib['class']:
|
||||
selected = True
|
||||
else:
|
||||
if selected:
|
||||
ref = li.find('a').attrib['id']
|
||||
break
|
||||
if ref is None:
|
||||
return
|
||||
form = self.page.get_form(name="years_form")
|
||||
form.pop('years_form:j_idcl')
|
||||
form.pop('years_form:_link_hidden_')
|
||||
form['AJAXREQUEST'] = "years_form:year_region"
|
||||
form[ref] = ref
|
||||
return form.request
|
||||
|
||||
class item(ItemElement):
|
||||
klass = Bill
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ class INGVirtKeyboard(VirtKeyboard):
|
|||
return coordinates
|
||||
|
||||
|
||||
|
||||
class LoginPage(HTMLPage):
|
||||
def prelogin(self, login, birthday):
|
||||
# First step : login and birthday
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue