Skip to content

Commit 02b7baa

Browse files
committed
Make sure headless browser windows are big enough
1 parent 14607a0 commit 02b7baa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,6 +2259,15 @@ def get_new_driver(self, browser=None, headless=None,
22592259
self._drivers_list.append(new_driver)
22602260
if switch_to:
22612261
self.driver = new_driver
2262+
if self.headless:
2263+
# Make sure the invisible browser window is big enough
2264+
try:
2265+
self.set_window_size(1920, 1200)
2266+
except Exception:
2267+
# This shouldn't fail, but in case it does,
2268+
# get safely through setUp() so that
2269+
# WebDrivers can get closed during tearDown().
2270+
pass
22622271
return new_driver
22632272

22642273
def switch_to_driver(self, driver):

0 commit comments

Comments
 (0)