2
2
import os
3
3
import re
4
4
import sys
5
+ import time
5
6
import urllib3
6
7
import warnings
7
8
from selenium import webdriver
@@ -1518,17 +1519,21 @@ def get_local_driver(
1518
1519
)
1519
1520
except BaseException as e :
1520
1521
if (
1521
- "Process unexpectedly closed" in str (e )
1522
+ "geckodriver unexpectedly exited" in str (e )
1523
+ or "Process unexpectedly closed" in str (e )
1522
1524
or "Failed to read marionette port" in str (e )
1523
1525
or "A connection attempt failed" in str (e )
1524
1526
or hasattr (e , "msg" ) and (
1525
- "Process unexpectedly closed" in e .msg
1527
+ "geckodriver unexpectedly exited" in e .msg
1528
+ or "Process unexpectedly closed" in e .msg
1526
1529
or "Failed to read marionette port" in e .msg
1527
1530
or "A connection attempt failed" in e .msg
1528
1531
)
1529
1532
):
1530
- # Firefox probably just auto-updated itself.
1533
+ # Firefox probably just auto-updated itself,
1534
+ # which causes intermittent issues to occur.
1531
1535
# Trying again right after that often works.
1536
+ time .sleep (0.1 )
1532
1537
return webdriver .Firefox (
1533
1538
service = service ,
1534
1539
options = firefox_options ,
@@ -1550,17 +1555,21 @@ def get_local_driver(
1550
1555
)
1551
1556
except BaseException as e :
1552
1557
if (
1553
- "Process unexpectedly closed" in str (e )
1558
+ "geckodriver unexpectedly exited" in str (e )
1559
+ or "Process unexpectedly closed" in str (e )
1554
1560
or "Failed to read marionette port" in str (e )
1555
1561
or "A connection attempt failed" in str (e )
1556
1562
or hasattr (e , "msg" ) and (
1557
- "Process unexpectedly closed" in e .msg
1563
+ "geckodriver unexpectedly exited" in e .msg
1564
+ or "Process unexpectedly closed" in e .msg
1558
1565
or "Failed to read marionette port" in e .msg
1559
1566
or "A connection attempt failed" in e .msg
1560
1567
)
1561
1568
):
1562
- # Firefox probably just auto-updated itself.
1569
+ # Firefox probably just auto-updated itself,
1570
+ # which causes intermittent issues to occur.
1563
1571
# Trying again right after that often works.
1572
+ time .sleep (0.1 )
1564
1573
return webdriver .Firefox (
1565
1574
service = service ,
1566
1575
options = firefox_options ,
0 commit comments