7

Till yesterday: The below code was working fine.

System.setProperty("webdriver.chrome.driver", "/Users../Applications/chromedriver");

WebDriver driver = new ChromeDriver();
driver.get("www.google.com");

Dimension dim = new Dimension(1280,5277);
driver.manage().window().setSize(dim);

driver.quit();

But today morning it started throwing: Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created exception

I read several answers in Stackoverflow. I understood that this error is thrown if there is a version mismatch between the selenium webdriver and chrome driver. So I download the latest Selenium Webdriver(3.0.1 for java) and chromedriver(2.4).I get an error

org.openqa.selenium.NoSuchSessionException: no such session

So reverted back to the version I was using(2.53 for selenium web driver, I get the same error.

I tried below solutions:

killing all the chromedriver processes.

Rebooting the machine.

Eclipse->project clean

Nothing helps

fool-dev
  • 7,671
  • 9
  • 40
  • 54
Uma Senthil
  • 423
  • 2
  • 5
  • 18
  • 1
    Chrome 54? http://stackoverflow.com/questions/40240299/chrome-driver-stopped-working-for-chrome-browser-version-54-with-the-latest-chro – jibbs Oct 25 '16 at 19:33
  • 1
    Thank you @jibbs! Yes it is Chrome 54. It is not the chrome driver version or Selenium web driver version. It is the Google chrome update. Reverted back to version 53, It worked. – Uma Senthil Oct 25 '16 at 21:05
  • Use chromedriver version 2.25 with Selenium 3, it works for me – Dina Bo Nov 30 '16 at 10:10

3 Answers3

1

The first error you encountered was indeed caused by a mismatch in the binary 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 a 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.

It's a common mistake where you delete the session, either by calling .quit() or by closing the last window or tab, then attempting 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")
Gidoneli
  • 123
  • 8
-1

System.setProperty("webdriver.chrome.driver", "/Users../Applications/chromedriver")

need to change in above Line System.setProperty("Webdriver.chrome.driver", "/Users../Applications/chromedriver")

W should be capital letter

Justin Lambert
  • 940
  • 1
  • 7
  • 13
-1

Here is a bit of code I used with working with Selenium. Make sure your Chrome Driver is the correct version.

// Link to Chrome Driver
// This gives Selenium access to the Chrome Driver in the parent directory
        System.setProperty("webdriver.chrome.driver", "chromedriver.exe");

// Launches Driver
        final WebDriver driver = new ChromeDriver();
        driver.get("http://google.com/");

// Maximizes Google Chrome window
        driver.manage().window().maximize();
Ayren King
  • 417
  • 8
  • 16