From 07beeafa50f19ba699da53cae5407c6803562777 Mon Sep 17 00:00:00 2001 From: liamb13 <69778531+liamb13@users.noreply.github.com> Date: Mon, 22 May 2023 13:16:48 +1000 Subject: [PATCH] Update screenshot_downloader.py Scrolls comment into view. Without, it can break --- video_creation/screenshot_downloader.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index ecff2f4..636a833 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -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: