Skip to content

Commit b8a0463

Browse files
committed
Fix issue with taking screenshots in headless mode
1 parent 912c7fc commit b8a0463

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,9 @@ def _set_chrome_options(
670670
chrome_options.add_argument("--disable-translate")
671671
if not enable_3d_apis:
672672
chrome_options.add_argument("--disable-3d-apis")
673+
if headless or headless2 or is_using_uc(undetectable, browser_name):
674+
chrome_options.add_argument("--disable-renderer-backgrounding")
675+
chrome_options.add_argument("--disable-backgrounding-occluded-windows")
673676
if (
674677
is_using_uc(undetectable, browser_name)
675678
and (
@@ -2062,6 +2065,9 @@ def get_local_driver(
20622065
edge_options.add_argument("--disable-prompt-on-repost")
20632066
if not enable_3d_apis:
20642067
edge_options.add_argument("--disable-3d-apis")
2068+
if headless or headless2 or is_using_uc(undetectable, browser_name):
2069+
edge_options.add_argument("--disable-renderer-backgrounding")
2070+
edge_options.add_argument("--disable-backgrounding-occluded-windows")
20652071
if (
20662072
selenium4_or_newer
20672073
and page_load_strategy

seleniumbase/undetected/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ def __init__(
225225
"--password-store=basic",
226226
]
227227
)
228-
options.add_argument("--disable-renderer-backgrounding")
229-
options.add_argument("--disable-backgrounding-occluded-windows")
230228
if headless or options.headless:
231229
options.headless = True
232230
options.add_argument("--no-sandbox")

0 commit comments

Comments
 (0)