catch the right exception

This commit is contained in:
Romain Bignon 2013-01-08 23:09:24 +01:00
commit d0b546cc15

View file

@ -34,7 +34,7 @@ class UnavailablePage(BasePage):
def on_loaded(self): def on_loaded(self):
try: try:
a = self.document.xpath('//a[@class="btn"]')[0] a = self.document.xpath('//a[@class="btn"]')[0]
except KeyError: except IndexError:
raise BrowserUnavailable() raise BrowserUnavailable()
else: else:
self.browser.location(a.attrib['href']) self.browser.location(a.attrib['href'])