Catch error on password/birthday/login as BrowserIncorrectPassword
This commit is contained in:
parent
7cc8e319c3
commit
4fe8f13984
2 changed files with 12 additions and 5 deletions
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from weboob.tools.browser import BaseBrowser
|
||||
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
|
||||
from .pages import AccountsList, LoginPage, LoginPage2, \
|
||||
AccountHistory
|
||||
|
||||
|
|
@ -60,6 +60,8 @@ class Ing(BaseBrowser):
|
|||
|
||||
self.page.prelogin(self.username, self.birthday)
|
||||
self.page.login(self.password)
|
||||
if self.page.error():
|
||||
raise BrowserIncorrectPassword()
|
||||
|
||||
def get_accounts_list(self):
|
||||
if not self.is_on_page(AccountsList):
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import re
|
|||
from weboob.tools.mech import ClientForm
|
||||
from logging import error
|
||||
|
||||
from weboob.tools.browser import BasePage
|
||||
from weboob.tools.browser import BasePage, BrowserIncorrectPassword
|
||||
from weboob.tools.captcha.virtkeyboard import VirtKeyboard, VirtKeyboardError
|
||||
import tempfile
|
||||
|
||||
|
|
@ -46,9 +46,10 @@ class INGVirtKeyboard(VirtKeyboard):
|
|||
|
||||
def __init__(self, basepage):
|
||||
divkeyboard = basepage.document.find("//div[@id='clavierdisplayLogin']")
|
||||
img = divkeyboard.xpath("img")[1]
|
||||
if img is None:
|
||||
return False
|
||||
try:
|
||||
img = divkeyboard.xpath("img")[1]
|
||||
except:
|
||||
raise BrowserIncorrectPassword()
|
||||
url = img.attrib.get("src")
|
||||
coords = {}
|
||||
coords["11"] = (5, 5, 33, 33)
|
||||
|
|
@ -101,6 +102,10 @@ class LoginPage(BasePage):
|
|||
self.browser['zone1Form:radioSaveClientNumber'] = False
|
||||
self.browser.submit(nologin=True)
|
||||
|
||||
def error(self):
|
||||
error = self.document.find('//span[@class="error"]')
|
||||
return error is not None
|
||||
|
||||
|
||||
class LoginPage2(BasePage):
|
||||
def on_loaded(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue