Update screenshot_downloader.py

Scrolls comment into view. Without, it can break
pull/1578/head
liamb13 2 years ago committed by GitHub
parent 637e4c66f2
commit 07beeafa50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -230,6 +230,8 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int):
zoom = settings.config["settings"]["zoom"]
# zoom the body of the page
page.evaluate("document.body.style.zoom="+str(zoom))
# scroll comment into view
page.locator(f"#t1_{comment['comment_id']}").scroll_into_view_if_needed()
# as zooming the body doesn't change the properties of the divs, we need to adjust for the zoom
location = page.locator(f"#t1_{comment['comment_id']}").bounding_box()
for i in location:

Loading…
Cancel
Save