Created
September 10, 2020 03:21
-
-
Save dev4Fun/ee37ad5a38deaac95f00d603919360e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pathlib | |
| from selenium import webdriver | |
| import config | |
| def configure_chrome_driver(): | |
| options = webdriver.ChromeOptions() | |
| options.add_argument(f"user-data-dir={pathlib.Path(__file__).parent.absolute().joinpath('chrome-profile')}") | |
| # disable image loading for better performance | |
| # options.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2}) | |
| the_driver = webdriver.Chrome(executable_path=config.DRIVER_EXECUTABLE_PATH, options=options) | |
| # page loading time and wait time for page reload | |
| the_driver.set_page_load_timeout(5) | |
| the_driver.implicitly_wait(2) | |
| return the_driver |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment