This error message...
Exception in thread "Thread-23" org.openqa.selenium.WebDriverException: Session [null] not available and is not among the last 1000 terminated sessions.
Active sessions are[ext. key 3e5f8fb2ae3b0c5cddc8817f80eb8fe1]
Command duration or timeout: 92 milliseconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
...implies that the Selenium Grid Node was unable to communicate with the Selenium Grid Hub.
Deep Dive
This error is defined in ActiveTestSessions.java and is defined as:
public TestSession getExistingSession(ExternalSessionKey externalkey) {
TestSession sessionByExternalKey = findSessionByExternalKey(externalkey);
if (sessionByExternalKey == null) {
SessionTerminationReason sessionTerminationReason = reasons.get(externalkey);
String keyId = externalkey != null ? externalkey.getKey() : "(null externalkey)";
if (sessionTerminationReason != null) {
String msg = "Session [" + keyId + "] was terminated due to " + sessionTerminationReason;
log.fine(msg);
throw new GridException(msg);
} else {
String msg = "Session [" + keyId + "] not available and is not among the last 1000 terminated sessions.\n"
+ "Active sessions are" + this.unmodifiableSet();
log.fine(msg);
throw new GridException(msg);
}
}
return sessionByExternalKey;
}
As per the following discussions:
It seems this error stems out when:
- Selenium Grid Hub, Selenium Grid Node and the Client Process are initiated/spawned from different versions of Selenium client.
Solution
Ensure that Selenium Grid Hub, Selenium Grid Node and the Client Process all of them uses the same version of Selenium client i.e. Selenium v3.141.59
Update 1
In normal circumstances you should have observed Selenium Webdriver + Java - Eclipse: java.lang.NoClassDefFoundError incase of presence of multiple versions of the same jar. A bit more details interms of your Test Architecture would have helped us to debug the issue in a better way. Possibly you need to clean up as follows:
mvn clean
mvn install
- or
mvn clean install
mvn test
Update 2
As the last resort you can delete the MAVEN_HOME
i.e. ~/.m2
and re-initiate the build process.