Simplify the code
This commit is contained in:
parent
af570a856f
commit
1994970385
3 changed files with 10 additions and 18 deletions
|
|
@ -145,7 +145,7 @@ class IngBrowser(LoginBrowser):
|
||||||
@need_login
|
@need_login
|
||||||
def get_recipients(self, account):
|
def get_recipients(self, account):
|
||||||
self.transferpage.stay_or_go()
|
self.transferpage.stay_or_go()
|
||||||
if self.page.ischecked(account):
|
if self.page.ischecked(account.id):
|
||||||
return self.page.get_recipients()
|
return self.page.get_recipients()
|
||||||
else:
|
else:
|
||||||
# It is hard to check the box and to get the real list.
|
# It is hard to check the box and to get the real list.
|
||||||
|
|
|
||||||
|
|
@ -108,11 +108,9 @@ class LoginPage(HTMLPage):
|
||||||
return False
|
return False
|
||||||
realpasswd = ""
|
realpasswd = ""
|
||||||
span = self.doc.find('//span[@id="digitpaddisplayLogin"]')
|
span = self.doc.find('//span[@id="digitpaddisplayLogin"]')
|
||||||
i = 0
|
for i, font in enumerate(span.getiterator('font')):
|
||||||
for font in span.getiterator('font'):
|
|
||||||
if font.attrib.get('class') == "vide":
|
if font.attrib.get('class') == "vide":
|
||||||
realpasswd += password[i]
|
realpasswd += password[i]
|
||||||
i += 1
|
|
||||||
self.browser.logger.debug('We are looking for : ' + realpasswd)
|
self.browser.logger.debug('We are looking for : ' + realpasswd)
|
||||||
self.browser.logger.debug("Coordonates: " + vk.get_string_code(realpasswd))
|
self.browser.logger.debug("Coordonates: " + vk.get_string_code(realpasswd))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,20 +55,15 @@ class TransferPage(LoggedPage, HTMLPage):
|
||||||
recipient._type = "ext"
|
recipient._type = "ext"
|
||||||
yield recipient
|
yield recipient
|
||||||
|
|
||||||
def ischecked(self, account):
|
def ischecked(self, _id):
|
||||||
id = account.id
|
|
||||||
# remove prefix (CC-, LA-, ...)
|
# remove prefix (CC-, LA-, ...)
|
||||||
if "-" in id:
|
if "-" in _id:
|
||||||
id = id.split('-')[1]
|
_id = _id.split('-')[1]
|
||||||
option = self.doc.xpath('//input[@value="%s"]' % id)
|
|
||||||
if len(option) == 0:
|
|
||||||
raise AccountNotFound()
|
|
||||||
else:
|
|
||||||
option = option[0]
|
|
||||||
try:
|
try:
|
||||||
return option.attrib["checked"] == "checked"
|
option = self.doc.xpath('//input[@value="%s"]' % _id)[0]
|
||||||
except:
|
except:
|
||||||
return False
|
raise AccountNotFound()
|
||||||
|
return option.attrib.get("checked") == "checked"
|
||||||
|
|
||||||
def transfer(self, recipient, amount, reason):
|
def transfer(self, recipient, amount, reason):
|
||||||
form = self.get_form(name="transfer_form")
|
form = self.get_form(name="transfer_form")
|
||||||
|
|
@ -138,13 +133,12 @@ class TransferConfirmPage(HTMLPage):
|
||||||
except VirtKeyboardError as err:
|
except VirtKeyboardError as err:
|
||||||
error("Error: %s" % err)
|
error("Error: %s" % err)
|
||||||
return
|
return
|
||||||
|
|
||||||
realpasswd = ""
|
realpasswd = ""
|
||||||
span = self.doc.find('//span[@id="digitpadtransfer"]')
|
span = self.doc.find('//span[@id="digitpadtransfer"]')
|
||||||
i = 0
|
for i, font in enumerate(span.getiterator('font')):
|
||||||
for font in span.getiterator('font'):
|
|
||||||
if font.attrib.get('class') == "vide":
|
if font.attrib.get('class') == "vide":
|
||||||
realpasswd += password[i]
|
realpasswd += password[i]
|
||||||
i += 1
|
|
||||||
self.browser.logger.debug('We are looking for : ' + realpasswd)
|
self.browser.logger.debug('We are looking for : ' + realpasswd)
|
||||||
coordinates = vk.get_string_code(realpasswd)
|
coordinates = vk.get_string_code(realpasswd)
|
||||||
self.browser.logger.debug("Coordonates: " + coordinates)
|
self.browser.logger.debug("Coordonates: " + coordinates)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue