@@ -208,6 +208,14 @@ def capture_fullpage_screenshot(self, filename: str = DEFAULT_FILENAME_FULLPAGE)
208208 scrolling. It works by temporarily resizing the browser window to show
209209 the full page height, taking the screenshot, then restoring the original size.
210210
211+ *Important Note on Screen Size Limitations:*
212+ When running in non-headless mode (regular browser window), the browser
213+ may be unable to resize beyond the physical screen dimensions. In such cases,
214+ the screenshot will capture only what fits within the maximum window size
215+ the browser can achieve, and a warning will be logged. For reliable full-page
216+ screenshots of tall pages, it is recommended to run the browser in headless
217+ mode, which does not have screen size limitations.
218+
211219 ``filename`` argument specifies where to save the screenshot file.
212220 The directory can be set with `Set Screenshot Directory` keyword or
213221 when importing the library. If not configured, screenshots go to the
@@ -256,6 +264,17 @@ def _capture_fullpage_screenshot_to_file(self, filename):
256264 import time
257265 time .sleep (0.5 )
258266
267+ # Verify the window actually resized to requested dimensions
268+ # In non-headless mode, browsers may be limited by screen size
269+ actual_size = self .driver .get_window_size ()
270+ if actual_size ['height' ] < full_height * 0.95 : # Allow 5% tolerance for browser chrome
271+ self .warn (
272+ f"Browser window could not be resized to full page height. "
273+ f"Requested: { full_height } px, Actual: { actual_size ['height' ]} px. "
274+ f"Screenshot may not capture the complete page. "
275+ f"Consider running in headless mode for better full-page screenshot support."
276+ )
277+
259278 # Now take the screenshot
260279 path = self ._get_screenshot_path (filename )
261280 self ._create_directory (path )
@@ -284,6 +303,17 @@ def _capture_fullpage_screen_to_log(self, return_val):
284303 import time
285304 time .sleep (0.5 )
286305
306+ # Verify the window actually resized to requested dimensions
307+ # In non-headless mode, browsers may be limited by screen size
308+ actual_size = self .driver .get_window_size ()
309+ if actual_size ['height' ] < full_height * 0.95 : # Allow 5% tolerance for browser chrome
310+ self .warn (
311+ f"Browser window could not be resized to full page height. "
312+ f"Requested: { full_height } px, Actual: { actual_size ['height' ]} px. "
313+ f"Screenshot may not capture the complete page. "
314+ f"Consider running in headless mode for better full-page screenshot support."
315+ )
316+
287317 # Take the screenshot as base64
288318 screenshot_as_base64 = self .driver .get_screenshot_as_base64 ()
289319 base64_str = self ._embed_to_log_as_base64 (screenshot_as_base64 , 800 )
0 commit comments