'session not created exception while running Selenium webdriver
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
Solution 1:[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
Solution 2:[2]
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();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Justin Lambert |
Solution 2 | Ayren King |