22import os
33import re
44import sys
5+ import time
56import urllib3
67import warnings
78from selenium import webdriver
@@ -1518,17 +1519,21 @@ def get_local_driver(
15181519 )
15191520 except BaseException as e :
15201521 if (
1521- "Process unexpectedly closed" in str (e )
1522+ "geckodriver unexpectedly exited" in str (e )
1523+ or "Process unexpectedly closed" in str (e )
15221524 or "Failed to read marionette port" in str (e )
15231525 or "A connection attempt failed" in str (e )
15241526 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
15261529 or "Failed to read marionette port" in e .msg
15271530 or "A connection attempt failed" in e .msg
15281531 )
15291532 ):
1530- # Firefox probably just auto-updated itself.
1533+ # Firefox probably just auto-updated itself,
1534+ # which causes intermittent issues to occur.
15311535 # Trying again right after that often works.
1536+ time .sleep (0.1 )
15321537 return webdriver .Firefox (
15331538 service = service ,
15341539 options = firefox_options ,
@@ -1550,17 +1555,21 @@ def get_local_driver(
15501555 )
15511556 except BaseException as e :
15521557 if (
1553- "Process unexpectedly closed" in str (e )
1558+ "geckodriver unexpectedly exited" in str (e )
1559+ or "Process unexpectedly closed" in str (e )
15541560 or "Failed to read marionette port" in str (e )
15551561 or "A connection attempt failed" in str (e )
15561562 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
15581565 or "Failed to read marionette port" in e .msg
15591566 or "A connection attempt failed" in e .msg
15601567 )
15611568 ):
1562- # Firefox probably just auto-updated itself.
1569+ # Firefox probably just auto-updated itself,
1570+ # which causes intermittent issues to occur.
15631571 # Trying again right after that often works.
1572+ time .sleep (0.1 )
15641573 return webdriver .Firefox (
15651574 service = service ,
15661575 options = firefox_options ,
0 commit comments