on ajoute des try/catches
This commit is contained in:
parent
dd4eb5221c
commit
e71d65f04f
@ -86,6 +86,30 @@ class ChromiumHeadlessDownloader(Downloader):
|
|||||||
raise Exception("POST method with Chromium headless not yet implemented")
|
raise Exception("POST method with Chromium headless not yet implemented")
|
||||||
print("Download {}".format(url))
|
print("Download {}".format(url))
|
||||||
|
|
||||||
self.driver.get(url)
|
try:
|
||||||
doc = self.driver.page_source
|
self.driver.get(url)
|
||||||
|
doc = self.driver.page_source
|
||||||
|
|
||||||
|
except exceptions.StaleElementReferenceException as e:
|
||||||
|
print(f">> {type(e).__name__}: {e.args}")
|
||||||
|
return None
|
||||||
|
except exceptions.NoSuchElementException as e:
|
||||||
|
print(f">> {type(e).__name__}: {e.args}")
|
||||||
|
return None
|
||||||
|
except exceptions.TimeoutException as e:
|
||||||
|
print(f">> {type(e).__name__}: {e.args}")
|
||||||
|
return None
|
||||||
|
except exceptions.WebDriverException as e:
|
||||||
|
print(f">> {type(e).__name__}: {e.args}")
|
||||||
|
return None
|
||||||
|
except exceptions.SessionNotCreatedException as e:
|
||||||
|
print(f">> {type(e).__name__}: {e.args}")
|
||||||
|
return None
|
||||||
|
except Exception as e:
|
||||||
|
print(f">> {type(e).__name__} line {e.__traceback__.tb_lineno} of {__file__}: {e.args}")
|
||||||
|
return None
|
||||||
|
except:
|
||||||
|
print(f">> General Exception: {URL}")
|
||||||
|
return None
|
||||||
|
|
||||||
return doc
|
return doc
|
||||||
|
Loading…
Reference in New Issue
Block a user