From 04ec1902860aebd6c261995cf1dbc015b5f913ec Mon Sep 17 00:00:00 2001 From: Guillaume Risbourg Date: Wed, 18 Sep 2019 16:01:55 +0200 Subject: [PATCH] [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 --- modules/bp/browser.py | 2 +- modules/bp/pages/subscription.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/bp/browser.py b/modules/bp/browser.py index 0af2b74243..b76d7bbfbb 100644 --- a/modules/bp/browser.py +++ b/modules/bp/browser.py @@ -525,7 +525,7 @@ def iter_subscriptions(self): @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 diff --git a/modules/bp/pages/subscription.py b/modules/bp/pages/subscription.py index 073d3a9cb7..83c9d9063d 100644 --- a/modules/bp/pages/subscription.py +++ b/modules/bp/pages/subscription.py @@ -40,6 +40,7 @@ class item(ItemElement): 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 @@ def obj_date(self): 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 -- GitLab