Commit 30c861fb authored by Romain Bignon's avatar Romain Bignon

societegenerale: skip GDPR form and fix add recipients

On login, there is a form to ask user validating GDPR questions. It can
be skipped by calling a specific URL.

Also, the link to add a recipient was broken. To prevent eventual
compatibility break, the old XPath is kept.

NOTE: I CAN'T TEST REAL RECIPIENT ADD OR TRANSFERS, SO PERHAPS IT IS
STILL BROKEN LATER IN THE PROCESS.
parent b50ad152
......@@ -187,6 +187,8 @@ class AccountHistory(LoggedPage, BasePage):
not bool(Link('//a[contains(@href, "per_cptBen_ajouterFrBic")]', default=NotAvailable)(self.doc))
def on_load(self):
super(AccountHistory, self).on_load()
msg = CleanText('//span[@class="error_msg"]', default='')(self.doc)
if 'Le service est momentanément indisponible' in msg:
raise BrowserUnavailable(msg)
......
......@@ -27,6 +27,10 @@ from weboob.browser.filters.standard import CleanText
class BasePage(HTMLPage):
def on_load(self):
if self.doc.xpath('//script[contains(text(), "gdpr/recueil")]'):
self.browser.open('https://particuliers.secure.societegenerale.fr/icd/gdpr/data/gdpr-update-compteur-clicks-client.json')
def get_error(self):
try:
return self.doc.xpath('//span[@class="error_msg"]')[0].text.strip()
......
......@@ -33,7 +33,7 @@ from weboob.capabilities.bank import (
from weboob.capabilities.base import find_object, NotAvailable, empty
from weboob.browser.filters.standard import CleanText, Regexp, CleanDecimal, \
Env, Date
from weboob.browser.filters.html import Attr, Link
from weboob.browser.filters.html import Attr, Link, XPathNotFound
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.capabilities.bank.iban import is_iban_valid
from weboob.tools.value import Value, ValueBool
......@@ -78,7 +78,15 @@ class TransferPage(LoggedPage, BasePage, PasswordPage):
not bool(CleanText(u'//h1[contains(text(), "Ajouter un compte bénéficiaire de virement")]')(self.doc))
def get_add_recipient_link(self):
return Regexp(Link('//a[img[@src="/img/personnalisation/btn_ajouter_beneficiaire.jpg"]]'), 'javascript:window.location="([^"]+)"')(self.doc)
try:
link = Regexp(Link('//a[img[@src="/img/personnalisation/btn_ajouter_beneficiaire.jpg"]]'), 'javascript:window.location="([^"]+)"')(self.doc)
except XPathNotFound:
link = Regexp(Link(u'//a[contains(text(), "Ajouter un compte b")]'), 'javascript:window.location="([^"]+)"')(self.doc)
else:
# XXX check in logs if this message is visible. If not, we can remove the first xpath.
self.logger.debug('Old link found to add a recipient.')
return link
def on_load(self):
excluded_errors = [
......
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