diff --git a/modules/cragr/browser.py b/modules/cragr/browser.py index 9321eb0ae57fbbcc012081c69f726ac85d47427e..bbd3b2424eb7f5f6ecdfcf15e125bfd1638a33da 100644 --- a/modules/cragr/browser.py +++ b/modules/cragr/browser.py @@ -914,16 +914,20 @@ def get_profile(self): # There is one profile per space, so we only fetch the first one self.go_to_account_space(0) owner_type = self.page.get_owner_type() + profile_details = self.page.has_profile_details() self.profile_page.go(space=self.space) + if owner_type == 'PRIV': profile = self.page.get_user_profile() - self.profile_details.go(space=self.space) - self.page.fill_profile(obj=profile) + if profile_details: + self.profile_details.go(space=self.space) + self.page.fill_profile(obj=profile) return profile elif owner_type == 'ORGA': profile = self.page.get_company_profile() - self.pro_profile_details.go(space=self.space) - self.page.fill_profile(obj=profile) + if profile_details: + self.pro_profile_details.go(space=self.space) + self.page.fill_profile(obj=profile) return profile def get_space_info(self): diff --git a/modules/cragr/pages.py b/modules/cragr/pages.py index 9e33f50936311f902dc70ba03c1ff5d902cb3426..48733aebdc62dceda457095f61bc0a0adff43b26 100644 --- a/modules/cragr/pages.py +++ b/modules/cragr/pages.py @@ -314,6 +314,9 @@ def get_connection_id(self): def has_main_account(self): return Dict('comptePrincipal', default=None)(self.doc) + def has_profile_details(self): + return CleanText('//a[text()="Gérer mes coordonnées"]')(self.html_doc) + @method class get_main_account(ItemElement): klass = Account