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

response.meta and respose.request.meta['driver'] have different content. #103

Open
fabiobatalha opened this issue Oct 20, 2021 · 0 comments

Comments

@fabiobatalha
Copy link

Not sure what is going on but response.request.meta['driver'].get_screenshot_as_png() has a different result comparing with response.meta['screenshot'].

I noticed while handling multiple URLs that the response.request.meta['driver'] does not have the expected webpage content. It has an unpredictable behavior having a mismatching data structure while comparing with the content of the response.url.

In the script bellow, both images of the same uuid4 code saved in the file system were supposed to have the same content, but what we have is an unpredictable behavior where the response.meta['screenshot'] works as expected, but the screenshot produced by response.request.meta['driver'].get_screenshot_as_png() can be anything else.

    def parse(self, response):
        driver = response.request.meta['driver']
        code = uuid.uuid4()
        with open(f'image_driver-{code}.png', 'wb') as image_file:
            image_file.write(driver.get_screenshot_as_png())
        with open(f'image_response-{code}.png', 'wb') as image_file:
            image_file.write(response.meta['screenshot'])
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