I am trying to create a webcrawler using Selenium, but I get this error when I try to create the webdriver object.
selenium.common.exceptions.SessionNotCreatedEx
If you end up here and you're using Laravel / Dusk, try:
php artisan dusk:chrome-driver
In Summary:
There you go. All the best!
Just download chromedriver extension 2.8 or 2.9 from here.
Extract it and add this extension to /usr/local/bin
I faced this issue due to mismatch of chromedriver and chrome version. I followed the below steps to resolve my issue:
1) First, find out which version of Chrome you are using. My Chrome version was 77.0.3865.90.
2) Take the Chrome version number, remove the last part, and append the result to URL "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_". For example, with Chrome version 77.0.3865.90, you'd get a URL "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_77.0.3865".
3) Use the URL created in the last step to retrieve the version of ChromeDriver to use. For example, the above URL will get your a file containing "77.0.3865.40". (The actual number may change in the future, of course.)
4) I then did :
webdriverdownloader chrome:77.0.3865.40 on my mac terminal.
After this your Chromedriver and Chrome version must be in sync and the issue should be fixed.
Your chrome version is very old. Version 68 is not the latest version. For all operating systems, Chrome is currently in version 71+
. Please see the list here.
Alternatively, this is the link for downloading older versions.
You have to match the chromedriver version number and your web browser chrome version , If both of the version match then it is best.
> For Example - 1- your web browser chrome version is 77 ( For checking your web browser chrome version got to your web browser help and then About Google Chrome there you will find your web browser chrome version ) . 2- Now download same version here 77 chromedriver from https://chromedriver.chromium.org/downloads . 3- Make google chrome as your default web browser . All done . Your code will run fine.
from selenium import webdriver
driver=webdriver.Chrome("chromedriver.exe")
# Below line of code provide
driver.get('http://python.org')
html_doc=driver.page_source
print("Html code of http://python.org web page :",html_doc)