Commit 04ec1902 authored by Guillaume Risbourg's avatar Guillaume Risbourg Committed by ntome

[bp] get_params search for sub id instead of label

The search on the select with label was causing some issue when there
was some extra space in the middle of the label. Changed it to search
for the full id in the `value` attribute.

Closes: 34974@sibi
parent 333493a4
......@@ -525,7 +525,7 @@ class BPBrowser(LoginBrowser, StatesMixin):
@need_login
def iter_documents(self, subscription):
self.subscription.go()
params = self.page.get_params(sub_label=subscription.label)
params = self.page.get_params(subscription._full_id)
for year in self.page.get_years():
params['formulaire.anneeRecherche'] = year
......
......@@ -40,6 +40,7 @@ class SubscriptionPage(LoggedPage, HTMLPage):
klass = Subscription
obj_id = Regexp(Attr('.', 'value'), r'\w-(\w+)')
obj__full_id = CleanText('./@value')
obj_label = CleanText('.')
obj_subscriber = Env('subscriber')
......@@ -79,9 +80,9 @@ class SubscriptionPage(LoggedPage, HTMLPage):
dayfirst=True
)(self)
def get_params(self, sub_label):
def get_params(self, sub_full_id):
# the id is in the label
sub_value = Attr('//select[@id="compte"]/option[contains(text(), "%s")]' % sub_label, 'value')(self.doc)
sub_value = Attr('//select[@id="compte"]/option[contains(@value, "%s")]' % sub_full_id, 'value')(self.doc)
form = self.get_form(name='formulaireHistorique')
form['formulaire.numeroCompteRecherche'] = sub_value
......
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