From 7661dd801db5f952f73583e8dbbf6ace1ffe3a53 Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Tue, 10 Mar 2020 16:59:37 +0100 Subject: [PATCH] [netfinca] Handle specific class name for the last investment of the table Some investment tables have a different xpath from the other ones for the last line of the table. Closes: 17649@zendesk --- modules/netfinca/pages.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/netfinca/pages.py b/modules/netfinca/pages.py index 435bdd5211..08afd5c57f 100644 --- a/modules/netfinca/pages.py +++ b/modules/netfinca/pages.py @@ -151,7 +151,11 @@ def obj_quantity(self): def obj_label(self): tablecell = TableCell('label')(self)[0] - return CleanText(tablecell.xpath('./following-sibling::td[@class=""]/div/a')[0])(self) + tablecell_values = tablecell.xpath('./following-sibling::td[@class=""]/div/a') + if tablecell_values: + return CleanText(tablecell_values[0])(self) + # In rare cases the last invest of the table has a different class name + return CleanText(tablecell.xpath('./following-sibling::td[has-class("last")]/div/a')[0])(self) def obj_code(self): # We try to get the code from div. If we didn't find code in url, -- GitLab