Fix headless issues.

closes #2024
pull/2060/head
Jason 5 months ago
parent b4fadbcf21
commit 6318b398d1

@ -74,7 +74,7 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int):
print_substep("Launching Headless Browser...") print_substep("Launching Headless Browser...")
browser = p.chromium.launch( browser = p.chromium.launch(
headless=False headless=True
) # headless=False will show the browser for debugging purposes ) # headless=False will show the browser for debugging purposes
# Device scale factor (or dsf for short) allows us to increase the resolution of the screenshots # Device scale factor (or dsf for short) allows us to increase the resolution of the screenshots
# When the dsf is 1, the width of the screenshot is 600 pixels # When the dsf is 1, the width of the screenshot is 600 pixels
@ -86,6 +86,7 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int):
color_scheme="dark", color_scheme="dark",
viewport=ViewportSize(width=W, height=H), viewport=ViewportSize(width=W, height=H),
device_scale_factor=dsf, device_scale_factor=dsf,
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
) )
cookies = json.load(cookie_file) cookies = json.load(cookie_file)
cookie_file.close() cookie_file.close()

Loading…
Cancel
Save