Commit b2ab7da5 authored by Maxime Gasselin's avatar Maxime Gasselin Committed by Romain Bignon

[creditdunord] catch BrowserIncorrectPassword

To check error message we have to follow error url and check error
message ('Nous n'avons pas pu vous authentifier')

Closes: 37926@sibi
parent 1e18d013
......@@ -64,6 +64,8 @@ class CreditDuNordBrowser(LoginBrowser):
def do_login(self):
self.login.go().login(self.username, self.password)
if self.redirect.is_here():
self.page.check_error()
if self.accounts.is_here():
expired_error = self.page.get_password_expired()
if expired_error:
......
......@@ -98,7 +98,15 @@ class CDNVirtKeyboard(GridVirtKeyboard):
class RedirectPage(HTMLPage):
pass
def check_error(self):
error = CleanText(self.doc.xpath('//script[contains(text(), "erreur")]'))(self)
if error:
error_link = re.search(r'href="(.*)"', error).group(1)
error_page = self.browser.location(error_link)
err_message = CleanText(error_page.page.doc.xpath('//div/b[contains(@class, "attentionErreur")]'))(self)
if err_message == "Nous n'avons pas pu vous authentifier.":
raise BrowserIncorrectPassword("Nous n'avons pas pu vous authentifier.")
assert False, 'Never seen this error message before: %s' % err_message
class EntryPage(LoggedPage, HTMLPage):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment