Skip to content

Commit

Permalink
feat(utils): add timeout selenium driver
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasrodes committed Apr 12, 2022
1 parent f0a0e53 commit 99dc075
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/src/cowidev/utils/web/scraping.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ def sel_options(headless: bool = True, firefox: bool = False):
return op


def get_driver(headless: bool = True, download_folder: str = None, options=None, firefox: bool = False):
def get_driver(
headless: bool = True, download_folder: str = None, options=None, firefox: bool = False, timeout: int = None
):
if options is None:
options = sel_options(headless=headless, firefox=firefox)
if firefox:
Expand All @@ -150,6 +152,8 @@ def get_driver(headless: bool = True, download_folder: str = None, options=None,
driver = webdriver.Chrome(options=options)
if download_folder:
set_download_settings(driver, download_folder, firefox)
if timeout is not None:
driver.set_page_load_timeout(timeout)
return driver


Expand Down

0 comments on commit 99dc075

Please sign in to comment.