You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SessionNotCreated : selenium.common.exceptions.SessionNotCreatedException: Message: session not created: cannot connect to chrome at 127.0.0.1:61628 from chrome not reachable
#2186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
I have been using this code for more than 6 months. It was working completely fine. This error has been coming for the last 2 days since the new Chrome version (136.0.7103.49). It was working fine for version 135. I tried updating Chrome driver to the version that matches my Chrome version, I also used webdriver manager, hardcoded the path of Chrome driver. But nothing is working. I am using custom Chrome profiles, and that is necessary for my requirement.
The behaviour I am noticing is that when my code starts, it takes time to open Chrome, and it opens the Chrome profile that is supposed to open, but after that, it opens nothing, and after some time, it closes and shows the error selenium.common.exceptions.SessionNotCreatedException: Message: session not created: cannot connect to Chrome at 127.0.0.1:61628 from Chrome not reachable
OS: Windows 10
Python version : 3.10
selenium = "^4.25.0"
undetected-chromedriver = "^3.5.5"
webdriver-manager = "^4.0.2"
`
self.profile = profile
self.bot = bot
# options = webdriver.ChromeOptions()
options = uc.ChromeOptions()
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
if profile:
if is_custom_profile:
# If custom profile then use the direct path of the profile
options.add_argument(f"--user-data-dir={config.CHECKUP_PROFILE_DIR}")
else:
options.add_argument(f"--user-data-dir={config.CHROME_DATA_DIR}")
options.add_argument(f"--profile-directory={profile}")
self.reports_dir = os.path.join("reports")
self.temp_reports_dir = os.path.join(os.getcwd(),"temp_reports")
self.model_dir = os.path.join("model_files")
self.media_dir = os.path.join("media")
self.temp_media_dir = os.path.join("temp_media")
self.blog_dir = os.path.join(os.getcwd(),"blogs")
os.makedirs(self.reports_dir, exist_ok=True)
os.makedirs(self.temp_reports_dir, exist_ok=True)
os.makedirs(self.model_dir, exist_ok=True)
os.makedirs(self.media_dir, exist_ok=True)
os.makedirs(self.temp_media_dir, exist_ok=True)
os.makedirs(self.blog_dir, exist_ok=True)
"""
Changing the default download directory to temp_reports_dir directory.
Disabling the prompt for download and enabling the directory upgrade.
"""
prefs = {
"download.default_directory": self.temp_reports_dir,
"download.prompt_for_download": False,
"download.directory_upgrade": True,
"plugins.always_open_pdf_externally": True,
"printing.print_preview_sticky_settings.appState": '{"recentDestinations":[{"id":"Save as PDF","origin":"local"}],"selectedDestinationId":"Save as PDF","version":2,"headerFooter":false}',
"savefile.default_directory": self.temp_reports_dir
}
options.add_experimental_option("prefs", prefs)
options.add_argument("--kiosk-printing")
options.add_argument("--start-maximized")
self.driver = uc.Chrome(options=options)
# self.driver = webdriver.Chrome(options=options)
# self.driver = uc.Chrome(options=options,driver_executable_path=r"C:\Users\user\Downloads\chromedriver-win64\chromedriver.exe")
self.driver.implicitly_wait(10)
self.driver.execute_cdp_cmd("Page.setDownloadBehavior", {
"behavior": "allow",
"downloadPath": self.temp_reports_dir
})
`
Earlier, I was using user-data-dir instead of -- user-data-dir, but now it is just pasting the user data dir path in the URL . So I switched to the -- user-data-dir, but that is not working as well.
I also tried using webdriver from selenium, but got the same result.
The only thing that worked for me was that I downloaded the ChromeDriver and Chrome from https://googlechromelabs.github.io/chrome-for-testing/ of version 135. But this is not useful for me because it saves the profile data separately, and I have my Chrome profile data saved in the default path of Chrome.
If you can tell me how I can use my Chrome profile's userdata in Chrome for testing, or if you have any other solution. That would be great.
Thank you.
The text was updated successfully, but these errors were encountered:
Just to mention, I'm having very similar issues at the moment since 136 was released. I have raised an issue in the Selenium repo as well: SeleniumHQ/selenium#15688
Just to mention, I'm having very similar issues at the moment since 136 was released. I have raised an issue in the Selenium repo as well: SeleniumHQ/selenium#15688
@andy14bray
Thanks for letting me know. I have found the solution from the issue that you raised. One guy has posted on your thread.
The solution:
Instead of pointing directly at the "C:\Users{user_name}\AppData\Local\Google\Chrome\User Data" folder, create a simple "link" or "shortcut" to it, and reference that.
This way you dont have to copy the User Data folder to a new location.
The solution: Instead of pointing directly at the "C:\Users{user_name}\AppData\Local\Google\Chrome\User Data" folder, create a simple "link" or "shortcut" to it, and reference that. This way you dont have to copy the User Data folder to a new location.
I have been using this code for more than 6 months. It was working completely fine. This error has been coming for the last 2 days since the new Chrome version (136.0.7103.49). It was working fine for version 135. I tried updating Chrome driver to the version that matches my Chrome version, I also used webdriver manager, hardcoded the path of Chrome driver. But nothing is working. I am using custom Chrome profiles, and that is necessary for my requirement.
The behaviour I am noticing is that when my code starts, it takes time to open Chrome, and it opens the Chrome profile that is supposed to open, but after that, it opens nothing, and after some time, it closes and shows the error
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: cannot connect to Chrome at 127.0.0.1:61628 from Chrome not reachable
OS: Windows 10
Python version : 3.10
selenium = "^4.25.0"
undetected-chromedriver = "^3.5.5"
webdriver-manager = "^4.0.2"
`
`
Earlier, I was using
user-data-dir
instead of-- user-data-dir
, but now it is just pasting the user data dir path in the URL . So I switched to the-- user-data-dir
, but that is not working as well.I also tried using webdriver from selenium, but got the same result.
The only thing that worked for me was that I downloaded the ChromeDriver and Chrome from https://googlechromelabs.github.io/chrome-for-testing/ of version 135. But this is not useful for me because it saves the profile data separately, and I have my Chrome profile data saved in the default path of Chrome.
If you can tell me how I can use my Chrome profile's userdata in Chrome for testing, or if you have any other solution. That would be great.
Thank you.
The text was updated successfully, but these errors were encountered: