I'm facing an intermittent problem with Selenium tests executed from Azure pipelines on Microsoft hosted agents.
My framework based on Serenity BDD uses Chromedriver available in the system PATH variable.
From time to time, at the beginning of a test suite SessionNotCreatedException is thrown when the test code tries to open a url for the first time.
It looks like chromedriver cannot get in touch with the browser or cannot start it. Next test cases are usually successful and tests run as expected.
Here's the sequence of exceptions:
net.thucydides.core.webdriver.DriverConfigurationError:
WebDriver was unable to create a new instance of type class org.openqa.selenium.chrome.ChromeDriver
WebDriver reported the following message: Could not start a new session. Response code 500. Message: session not created: DevToolsActivePort file doesn't exist
[...]
Could not instantiate class org.openqa.selenium.chrome.ChromeDriver
[...]
WebDriver reported the following message: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: DevToolsActivePort file doesn't exist
Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to bind the port.