@@ -1068,6 +1068,7 @@ def get_remote_driver(
1068
1068
screen_resolution = None
1069
1069
browser_version = None
1070
1070
platform_name = None
1071
+ custom_caps = {}
1071
1072
for key in desired_caps .keys ():
1072
1073
capabilities [key ] = desired_caps [key ]
1073
1074
if key == "selenoid:options" :
@@ -1079,6 +1080,8 @@ def get_remote_driver(
1079
1080
browser_version = desired_caps [key ]
1080
1081
elif key == "platform" or key == "platformName" :
1081
1082
platform_name = desired_caps [key ]
1083
+ elif re .match ("[a-zA-Z0-9]*:[a-zA-Z0-9]*" , key ):
1084
+ custom_caps [key ] = desired_caps [key ]
1082
1085
if selenium4 :
1083
1086
chrome_options .set_capability ("cloud:options" , capabilities )
1084
1087
if selenoid :
@@ -1093,6 +1096,9 @@ def get_remote_driver(
1093
1096
if platform_name :
1094
1097
plat_name = platform_name
1095
1098
chrome_options .set_capability ("platformName" , plat_name )
1099
+ if custom_caps :
1100
+ for key in custom_caps :
1101
+ chrome_options .set_capability (key , custom_caps [key ])
1096
1102
return webdriver .Remote (
1097
1103
command_executor = address ,
1098
1104
options = chrome_options ,
@@ -1133,6 +1139,7 @@ def get_remote_driver(
1133
1139
screen_resolution = None
1134
1140
browser_version = None
1135
1141
platform_name = None
1142
+ custom_caps = {}
1136
1143
for key in desired_caps .keys ():
1137
1144
capabilities [key ] = desired_caps [key ]
1138
1145
if key == "selenoid:options" :
@@ -1144,6 +1151,8 @@ def get_remote_driver(
1144
1151
browser_version = desired_caps [key ]
1145
1152
elif key == "platform" or key == "platformName" :
1146
1153
platform_name = desired_caps [key ]
1154
+ elif re .match ("[a-zA-Z0-9]*:[a-zA-Z0-9]*" , key ):
1155
+ custom_caps [key ] = desired_caps [key ]
1147
1156
if selenium4 :
1148
1157
firefox_options .set_capability ("cloud:options" , capabilities )
1149
1158
if selenoid :
@@ -1158,6 +1167,9 @@ def get_remote_driver(
1158
1167
if platform_name :
1159
1168
plat_name = platform_name
1160
1169
firefox_options .set_capability ("platformName" , plat_name )
1170
+ if custom_caps :
1171
+ for key in custom_caps :
1172
+ firefox_options .set_capability (key , custom_caps [key ])
1161
1173
return webdriver .Remote (
1162
1174
command_executor = address ,
1163
1175
options = firefox_options ,
@@ -1278,6 +1290,7 @@ def get_remote_driver(
1278
1290
screen_resolution = None
1279
1291
browser_version = None
1280
1292
platform_name = None
1293
+ custom_caps = {}
1281
1294
for key in desired_caps .keys ():
1282
1295
capabilities [key ] = desired_caps [key ]
1283
1296
if key == "selenoid:options" :
@@ -1289,6 +1302,8 @@ def get_remote_driver(
1289
1302
browser_version = desired_caps [key ]
1290
1303
elif key == "platform" or key == "platformName" :
1291
1304
platform_name = desired_caps [key ]
1305
+ elif re .match ("[a-zA-Z0-9]*:[a-zA-Z0-9]*" , key ):
1306
+ custom_caps [key ] = desired_caps [key ]
1292
1307
if selenium4 :
1293
1308
opera_options .set_capability ("cloud:options" , capabilities )
1294
1309
if selenoid :
@@ -1303,6 +1318,9 @@ def get_remote_driver(
1303
1318
if platform_name :
1304
1319
plat_name = platform_name
1305
1320
opera_options .set_capability ("platformName" , plat_name )
1321
+ if custom_caps :
1322
+ for key in custom_caps :
1323
+ opera_options .set_capability (key , custom_caps [key ])
1306
1324
return webdriver .Remote (
1307
1325
command_executor = address ,
1308
1326
options = opera_options ,
0 commit comments