@@ -913,11 +913,12 @@ def get_remote_driver(
913913 import json
914914
915915 try :
916- extra_caps = json .loads (cap_string )
916+ extra_caps = json .loads (str ( cap_string ) )
917917 except Exception as e :
918918 p1 = "Invalid input format for --cap-string:\n %s" % e
919919 p2 = "The --cap-string input was: %s" % cap_string
920- p3 = "Enclose cap-string in SINGLE quotes; keys in DOUBLE quotes."
920+ p3 = ("Enclose cap-string in SINGLE quotes; "
921+ "keys and values in DOUBLE quotes." )
921922 p4 = (
922923 """Here's an example of correct cap-string usage:\n """
923924 """--cap-string='{"browserName":"chrome","name":"test1"}'"""
@@ -971,16 +972,23 @@ def get_remote_driver(
971972 capabilities = chrome_options .to_capabilities ()
972973 # Set custom desired capabilities
973974 selenoid = False
975+ selenoid_options = None
976+ screen_resolution = None
974977 for key in desired_caps .keys ():
975978 capabilities [key ] = desired_caps [key ]
976- if key == "selenoid" and desired_caps [ key ] :
979+ if key == "selenoid:options" :
977980 selenoid = True
981+ selenoid_options = desired_caps [key ]
982+ elif key == "screenResolution" :
983+ screen_resolution = desired_caps [key ]
978984 if selenium4 :
979985 chrome_options .set_capability ("cloud:options" , capabilities )
980986 if selenoid :
981- chrome_options .set_capability (
982- "selenoid:options" , {"enableVNC" : True }
983- )
987+ snops = selenoid_options
988+ chrome_options .set_capability ("selenoid:options" , snops )
989+ if screen_resolution :
990+ scres = screen_resolution
991+ chrome_options .set_capability ("screenResolution" , scres )
984992 return webdriver .Remote (
985993 command_executor = address ,
986994 options = chrome_options ,
@@ -1015,16 +1023,23 @@ def get_remote_driver(
10151023 capabilities ["moz:firefoxOptions" ] = {"args" : ["-headless" ]}
10161024 # Set custom desired capabilities
10171025 selenoid = False
1026+ selenoid_options = None
1027+ screen_resolution = None
10181028 for key in desired_caps .keys ():
10191029 capabilities [key ] = desired_caps [key ]
1020- if key == "selenoid" and desired_caps [ key ] :
1030+ if key == "selenoid:options" :
10211031 selenoid = True
1032+ selenoid_options = desired_caps [key ]
1033+ elif key == "screenResolution" :
1034+ screen_resolution = desired_caps [key ]
10221035 if selenium4 :
10231036 firefox_options .set_capability ("cloud:options" , capabilities )
10241037 if selenoid :
1025- firefox_options .set_capability (
1026- "selenoid:options" , {"enableVNC" : True }
1027- )
1038+ snops = selenoid_options
1039+ firefox_options .set_capability ("selenoid:options" , snops )
1040+ if screen_resolution :
1041+ scres = screen_resolution
1042+ firefox_options .set_capability ("screenResolution" , scres )
10281043 return webdriver .Remote (
10291044 command_executor = address ,
10301045 options = firefox_options ,
@@ -1190,16 +1205,23 @@ def get_remote_driver(
11901205 )
11911206 elif browser_name == constants .Browser .REMOTE :
11921207 selenoid = False
1208+ selenoid_options = None
1209+ screen_resolution = None
11931210 for key in desired_caps .keys ():
1194- if key == "selenoid" and desired_caps [ key ] :
1211+ if key == "selenoid:options" :
11951212 selenoid = True
1213+ selenoid_options = desired_caps [key ]
1214+ elif key == "screenResolution" :
1215+ screen_resolution = desired_caps [key ]
11961216 if selenium4 :
11971217 remote_options = ArgOptions ()
11981218 remote_options .set_capability ("cloud:options" , desired_caps )
11991219 if selenoid :
1200- remote_options .set_capability (
1201- "selenoid:options" , {"enableVNC" : True }
1202- )
1220+ snops = selenoid_options
1221+ remote_options .set_capability ("selenoid:options" , snops )
1222+ if screen_resolution :
1223+ scres = screen_resolution
1224+ remote_options .set_capability ("screenResolution" , scres )
12031225 return webdriver .Remote (
12041226 command_executor = address ,
12051227 options = remote_options ,
0 commit comments