Skip to content

Instantly share code, notes, and snippets.

@tzvc
Created November 7, 2022 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tzvc/083773e7c3ad5701791b099359ec5d17 to your computer and use it in GitHub Desktop.
Save tzvc/083773e7c3ad5701791b099359ec5d17 to your computer and use it in GitHub Desktop.

The first error you encountered was indeed caused by a mismatch in binaries version between Chrome and the WebDriver.

But you've already figured this out, so onto the issue you are facing now:

org.openqa.selenium.NoSuchSessionException: no such session

This error implies that the ChromeDriver was unable to communicate with the existing Browsing Context i.e. Chrome Browser session.

This can be due to a variety of reasons as discussed here. But given those issues have been fixed in more recent version of ChromeDriver, if you are still running into this issue now it's most likely due to explicit or implicit session deletion.

Its a common mistake where you delete the session, either by calling .quit() or by closing the last window or tab, then attempt to use the session again.

Example:

from selenium import webdriver

session = webdriver.Firefox()
print("Current session is {}".format(session.session_id))

# Explicit session deletion
session.quit()

# OR

# Implicit session deletion (close window/tab)
session.close()

# Attempting to use the session here will throw the NoSuchSessionException
session.get("https://example.com")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment