Skip to content

Commit 1757793

Browse files
committed
Set default user_agent in mobile mode if not set
1 parent 7cb08f9 commit 1757793

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3766,6 +3766,13 @@ def get_new_driver(
37663766
d_height = self.__device_height
37673767
if d_p_r is None:
37683768
d_p_r = self.__device_pixel_ratio
3769+
if is_mobile and not user_agent:
3770+
# Use the Pixel 4 user agent by default if not specified
3771+
user_agent = (
3772+
"Mozilla/5.0 (Linux; Android 11; Pixel 4 XL) "
3773+
"AppleWebKit/537.36 (KHTML, like Gecko) "
3774+
"Chrome/89.0.4389.105 Mobile Safari/537.36"
3775+
)
37693776
valid_browsers = constants.ValidBrowsers.valid_browsers
37703777
if browser_name not in valid_browsers:
37713778
raise Exception(

0 commit comments

Comments
 (0)