@@ -458,14 +458,6 @@ def _set_chrome_options(
458
458
return chrome_options
459
459
460
460
461
- def _set_safari_capabilities ():
462
- from selenium .webdriver .safari .webdriver import DesiredCapabilities as SDC
463
-
464
- safari_capabilities = SDC .SAFARI .copy ()
465
- safari_capabilities ["cleanSession" ] = True
466
- return safari_capabilities
467
-
468
-
469
461
def _set_firefox_options (
470
462
downloads_path ,
471
463
headless ,
@@ -1130,6 +1122,7 @@ def get_local_driver(
1130
1122
)
1131
1123
else :
1132
1124
if os .path .exists (LOCAL_GECKODRIVER ):
1125
+ warnings .simplefilter ("ignore" , category = DeprecationWarning )
1133
1126
return webdriver .Firefox (
1134
1127
executable_path = LOCAL_GECKODRIVER ,
1135
1128
options = firefox_options ,
@@ -1189,6 +1182,7 @@ def get_local_driver(
1189
1182
if not headless :
1190
1183
return webdriver .Ie (capabilities = ie_capabilities )
1191
1184
else :
1185
+ warnings .simplefilter ("ignore" , category = DeprecationWarning )
1192
1186
return webdriver .Ie (
1193
1187
executable_path = LOCAL_HEADLESS_IEDRIVER ,
1194
1188
capabilities = ie_capabilities ,
@@ -1265,11 +1259,15 @@ def get_local_driver(
1265
1259
sb_install .main (override = "edgedriver" )
1266
1260
sys .argv = sys_args # Put back the original sys args
1267
1261
1262
+ selenium4 = False
1263
+ if sys .version_info [0 ] == 3 and sys .version_info [1 ] >= 7 :
1264
+ selenium4 = True
1265
+
1268
1266
# For Microsoft Edge (Chromium) version 80 or higher
1269
- try :
1270
- from msedge . selenium_tools import Edge , EdgeOptions
1271
- except Exception :
1272
- os . system ( "pip install msedge-selenium-tools" )
1267
+ if selenium4 :
1268
+ Edge = webdriver . edge . webdriver . WebDriver
1269
+ EdgeOptions = webdriver . edge . webdriver . Options
1270
+ else :
1273
1271
from msedge .selenium_tools import Edge , EdgeOptions
1274
1272
1275
1273
if LOCAL_EDGEDRIVER and os .path .exists (LOCAL_EDGEDRIVER ):
@@ -1401,18 +1399,26 @@ def get_local_driver(
1401
1399
chromium_arg_item = "--" + chromium_arg_item
1402
1400
if len (chromium_arg_item ) >= 3 :
1403
1401
edge_options .add_argument (chromium_arg_item )
1404
- capabilities = edge_options .to_capabilities ()
1405
- capabilities ["platform" ] = ""
1406
- return Edge (
1407
- executable_path = LOCAL_EDGEDRIVER , capabilities = capabilities
1408
- )
1402
+ if selenium4 :
1403
+ warnings .simplefilter ("ignore" , category = DeprecationWarning )
1404
+ return Edge (
1405
+ executable_path = LOCAL_EDGEDRIVER ,
1406
+ options = edge_options ,
1407
+ )
1408
+ else :
1409
+ capabilities = edge_options .to_capabilities ()
1410
+ capabilities ["platform" ] = ""
1411
+ return Edge (
1412
+ executable_path = LOCAL_EDGEDRIVER ,
1413
+ capabilities = capabilities ,
1414
+ )
1409
1415
elif browser_name == constants .Browser .SAFARI :
1410
1416
arg_join = " " .join (sys .argv )
1411
1417
if ("-n" in sys .argv ) or (" -n=" in arg_join ) or (arg_join == "-c" ):
1412
1418
# Skip if multithreaded
1413
1419
raise Exception ("Can't run Safari tests in multi-threaded mode!" )
1414
- safari_capabilities = _set_safari_capabilities ( )
1415
- return webdriver .Safari ( desired_capabilities = safari_capabilities )
1420
+ warnings . simplefilter ( "ignore" , category = DeprecationWarning )
1421
+ return webdriver .safari . webdriver . WebDriver ( quiet = False )
1416
1422
elif browser_name == constants .Browser .OPERA :
1417
1423
try :
1418
1424
if LOCAL_OPERADRIVER and os .path .exists (LOCAL_OPERADRIVER ):
@@ -1539,6 +1545,8 @@ def get_local_driver(
1539
1545
if not headless or "linux" not in PLATFORM :
1540
1546
try :
1541
1547
if os .path .exists (LOCAL_CHROMEDRIVER ):
1548
+ warnings .simplefilter (
1549
+ "ignore" , category = DeprecationWarning )
1542
1550
driver = webdriver .Chrome (
1543
1551
executable_path = LOCAL_CHROMEDRIVER ,
1544
1552
options = chrome_options ,
@@ -1610,6 +1618,8 @@ def get_local_driver(
1610
1618
)
1611
1619
_mark_chromedriver_repaired ()
1612
1620
if os .path .exists (LOCAL_CHROMEDRIVER ):
1621
+ warnings .simplefilter (
1622
+ "ignore" , category = DeprecationWarning )
1613
1623
driver = webdriver .Chrome (
1614
1624
executable_path = LOCAL_CHROMEDRIVER ,
1615
1625
options = chrome_options ,
0 commit comments