tests/e2e: add retry for webdriver init

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-12 09:37:05 +01:00
parent c28f68400d
commit 3a51bcd890
1 changed files with 10 additions and 4 deletions

View File

@ -106,10 +106,16 @@ class SeleniumTestCase(StaticLiveServerTestCase):
return None
def _get_driver(self) -> WebDriver:
return webdriver.Remote(
command_executor="http://localhost:4444/wd/hub",
desired_capabilities=DesiredCapabilities.CHROME,
)
count = 0
while count < RETRIES:
try:
return webdriver.Remote(
command_executor="http://localhost:4444/wd/hub",
desired_capabilities=DesiredCapabilities.CHROME,
)
except WebDriverException:
count += 1
raise ValueError(f"Webdriver failed after {RETRIES}.")
def tearDown(self):
if "TF_BUILD" in environ: