Update screenshot_downloader.py

Fixes unable to zoom bug
pull/2138/head
Roostydoo2 10 months ago committed by GitHub
parent 62e7f17f02
commit 34aff6eead
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -177,7 +177,7 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int):
# zoom the body of the page
page.evaluate("document.body.style.zoom=" + str(zoom))
# as zooming the body doesn't change the properties of the divs, we need to adjust for the zoom
location = page.locator('[data-test-id="post-content"]').bounding_box()
location = page.locator('h1[slot="title"]').bounding_box()
for i in location:
location[i] = float("{:.2f}".format(location[i] * zoom))
page.screenshot(clip=location, path=postcontentpath)

Loading…
Cancel
Save