Commit e0dd263d authored by thibault douge's avatar thibault douge Committed by Vincent A

[freemobile] raise an error if we can't go on the offer page

parent 2837d6e9
Pipeline #3520 passed with stages
in 16 minutes and 31 seconds
......@@ -19,11 +19,13 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <>.
from __future__ import unicode_literals
import itertools
from weboob.browser import LoginBrowser, URL, need_login
from weboob.capabilities.messages import CantSendMessage
from weboob.exceptions import BrowserIncorrectPassword
from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable
from .pages import LoginPage, BillsPage, ProfilePage, PdfPage, OfferPage, OptionsPage
......@@ -61,8 +63,15 @@ class Freemobile(LoginBrowser):
def iter_subscription(self):
offerpage = self.offerpage.stay_or_go()
subscriptions = itertools.chain([offerpage.get_first_subscription()], offerpage.iter_next_subscription())
if self.login_page.is_here():
error =
if 'Vous ne pouvez pas avoir accès à cette page' in error:
raise BrowserUnavailable(error)
elif error:
raise AssertionError('Unexpected error at subscription: %s' % error)
subscriptions = itertools.chain([],
for subscription in subscriptions:
self.login_page.go(params={"switch-user": subscription._userid})
......@@ -39,7 +39,7 @@ class LoginPage(HTMLPage):
def get_error(self):
return CleanText('//div[@class="flash flash-error"]')(self.doc)
return CleanText('//div[has-class("flash")]')(self.doc)
class BillsPage(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