@@ -1509,18 +1509,23 @@ def get_local_driver(
1509
1509
if selenium4 :
1510
1510
service = FirefoxService (
1511
1511
executable_path = LOCAL_GECKODRIVER ,
1512
- log_path = os .path . devnull ,
1512
+ log_path = os .devnull ,
1513
1513
)
1514
1514
try :
1515
1515
return webdriver .Firefox (
1516
1516
service = service ,
1517
1517
options = firefox_options ,
1518
1518
)
1519
- except Exception as e :
1519
+ except BaseException as e :
1520
1520
if (
1521
- "Process unexpectedly closed" in e .msg
1522
- or "Failed to read marionette port" in e .msg
1523
- or "A connection attempt failed" in e .msg
1521
+ "Process unexpectedly closed" in str (e )
1522
+ or "Failed to read marionette port" in str (e )
1523
+ or "A connection attempt failed" in str (e )
1524
+ or hasattr (e , "msg" ) and (
1525
+ "Process unexpectedly closed" in e .msg
1526
+ or "Failed to read marionette port" in e .msg
1527
+ or "A connection attempt failed" in e .msg
1528
+ )
1524
1529
):
1525
1530
# Firefox probably just auto-updated itself.
1526
1531
# Trying again right after that often works.
@@ -1529,25 +1534,30 @@ def get_local_driver(
1529
1534
options = firefox_options ,
1530
1535
)
1531
1536
else :
1532
- raise Exception ( e . msg ) # Not an obvious fix.
1537
+ raise # Not an obvious fix.
1533
1538
else :
1534
1539
return webdriver .Firefox (
1535
1540
executable_path = LOCAL_GECKODRIVER ,
1536
- service_log_path = os .path . devnull ,
1541
+ service_log_path = os .devnull ,
1537
1542
options = firefox_options ,
1538
1543
)
1539
1544
else :
1540
1545
if selenium4 :
1541
- service = FirefoxService (log_path = os .path . devnull )
1546
+ service = FirefoxService (log_path = os .devnull )
1542
1547
try :
1543
1548
return webdriver .Firefox (
1544
1549
service = service , options = firefox_options
1545
1550
)
1546
- except Exception as e :
1551
+ except BaseException as e :
1547
1552
if (
1548
- "Process unexpectedly closed" in e .msg
1549
- or "Failed to read marionette port" in e .msg
1550
- or "A connection attempt failed" in e .msg
1553
+ "Process unexpectedly closed" in str (e )
1554
+ or "Failed to read marionette port" in str (e )
1555
+ or "A connection attempt failed" in str (e )
1556
+ or hasattr (e , "msg" ) and (
1557
+ "Process unexpectedly closed" in e .msg
1558
+ or "Failed to read marionette port" in e .msg
1559
+ or "A connection attempt failed" in e .msg
1560
+ )
1551
1561
):
1552
1562
# Firefox probably just auto-updated itself.
1553
1563
# Trying again right after that often works.
0 commit comments