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

Scrapy's USER_AGENT != Selenium user-agent #82

Open
ohld opened this issue Dec 1, 2020 · 0 comments
Open

Scrapy's USER_AGENT != Selenium user-agent #82

ohld opened this issue Dec 1, 2020 · 0 comments

Comments

@ohld
Copy link

ohld commented Dec 1, 2020

hey 👋

I just realized that Scrapy's USER_AGENT from settings.py doesn't equal Selenium's user_agent. I expect that scrapy-selenium will take that value and pass to driver's options.

I solved the issue with these lines in settings.py:

SELENIUM_DRIVER_ARGUMENTS = [
    '--headless',
    f'--user-agent={USER_AGENT}'
]

This is ok for now, but what if I would like to use scrapy_fake_useragent plugin to generate different User agents each time? In that case, my trick will not work.

I suppose, `scrapy-selenium' should add scrapy's USER_AGENT to driver's options automatically (maybe somewhere in middleware).

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

No branches or pull requests

1 participant