Commit aa9911e4 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

[boursorama] Correct cards disappearance again

The card page changed again and the numbers were in different xpaths so
the cards were not retrieved.

Closes: 9918@zendesk, 9987@zendesk
parent 3cfac69f
......@@ -793,7 +793,11 @@ class CardsNumberPage(LoggedPage, HTMLPage):
# With the card hash we can get the card number.
# Non activated cards have no card_hash and therefore no
# card number so we can easily eliminate them afterwards.
card.number = CleanText('//div[@data-card-key="%s"]/div/span' % card_hash)(self.doc)
card_details = CleanText('//div[@data-card-key="%s"]' % card_hash)(self.doc).replace(' ', '')
# We are looking for "4978********1234" in card_details:
number_search = re.search(r'\d{4}\*{8}\d{4}', card_details)
if number_search:
card.number = number_search.group(0)
class HomePage(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