NoSuchSessionException Session ID is null. Using WebDriver after calling quit()? when running the java tests in parallel NoSuchSessionException Session ID is null. Using WebDriver after calling quit()? when running the java tests in parallel selenium selenium

NoSuchSessionException Session ID is null. Using WebDriver after calling quit()? when running the java tests in parallel


Here is an explanation of what is happening:

You are calling driver.close() in RegisterNewUser. This will close the current window. If no open windows remain, the driver quits. So, when your tearDown calls driver.quit() the session has already ended and you get an error.

Solutions you could use:

  • don't call driver.close() in your test and let the teardown handle it

or

  • in teardown, check for a valid session and only call driver.quit() if one exists