Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing experimental_options to webdriver #99

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

erikkemperman
Copy link

@erikkemperman erikkemperman commented Oct 14, 2021

This allows us to pass "experimental options" from the scrapy configuration to the webdriver. For example, when using chrome, the following settings lets us avoid downloading any images -- reducing the downloaded bytes significantly:

{
    'SELENIUM_DRIVER_NAME': 'chrome',
    'SELENIUM_DRIVER_EXECUTABLE_PATH': which('chromedriver'),
    'SELENIUM_DRIVER_ARGUMENTS': ['--headless'],
    'SELENIUM_DRIVER_EXPERIMENTAL_OPTIONS': {
        'prefs': {
            'profile.managed_default_content_settings.images': 2
        }
    },
    'DOWNLOADER_MIDDLEWARES': {
        'scrapy_selenium.SeleniumMiddleware': 800
    }
}

@erikkemperman
Copy link
Author

erikkemperman commented Oct 14, 2021

PS This also addresses some problems in setup.py which, it seems to me, unnecessarily relied on pip internals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant