Skip to content
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.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome does not work with option('--user-data-dir') #431

Open
Danny-Sadya opened this issue Jan 2, 2022 · 1 comment
Open

Chrome does not work with option('--user-data-dir') #431

Danny-Sadya opened this issue Jan 2, 2022 · 1 comment

Comments

@Danny-Sadya
Copy link

Danny-Sadya commented Jan 2, 2022

Hi everyone! When I run chrome without the user data dir argument, everything works fine, but as soon as I add it I get the error cannot connect to chrome at 127.0.0.1:60358
from chrome not reachable. I have already added the argument "--disable-features=InfiniteSessionRestore", but nothing helped. Below is the stacktrace:
Traceback (most recent call last):
File "C:\PyProjects\ScrapingProjects\CoinListBot\bot.py", line 134, in
scraper = Scraper()
File "C:\PyProjects\ScrapingProjects\CoinListBot\bot.py", line 22, in init
self.driver = uc.Chrome(options=options, version_main=96)
File "C:\PyProjects\ScrapingProjects\CoinListBot\venv\lib\site-packages\undetected_chromedriver_init_.py", line 341, in init
super(Chrome, self).init(
File "C:\PyProjects\ScrapingProjects\CoinListBot\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in init
super(WebDriver, self).init(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\PyProjects\ScrapingProjects\CoinListBot\venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 93, in init
RemoteWebDriver.init(
File "C:\PyProjects\ScrapingProjects\CoinListBot\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 268, in init
self.start_session(capabilities, browser_profile)
File "C:\PyProjects\ScrapingProjects\CoinListBot\venv\lib\site-packages\undetected_chromedriver_init_.py", line 532, in start_session
super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
File "C:\PyProjects\ScrapingProjects\CoinListBot\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 359, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\PyProjects\ScrapingProjects\CoinListBot\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 424, in execute
self.error_handler.check_response(response)
File "C:\PyProjects\ScrapingProjects\CoinListBot\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:60358
from chrome not reachable
Stacktrace:
Backtrace:
Ordinal0 [0x00756903+2517251]
Ordinal0 [0x006EF8E1+2095329]
Ordinal0 [0x005F2710+1058576]
Ordinal0 [0x005E75CE+1013198]
Ordinal0 [0x0061056E+1181038]
Ordinal0 [0x0060A3FB+1156091]
Ordinal0 [0x0060A1E1+1155553]
Ordinal0 [0x0063AAAF+1354415]
Ordinal0 [0x0063A71A+1353498]
Ordinal0 [0x0063639B+1336219]
Ordinal0 [0x006127A7+1189799]
Ordinal0 [0x00613609+1193481]
GetHandleVerifier [0x008E5904+1577972]
GetHandleVerifier [0x00990B97+2279047]
GetHandleVerifier [0x007E6D09+534521]
GetHandleVerifier [0x007E5DB9+530601]
Ordinal0 [0x006F4FF9+2117625]
Ordinal0 [0x006F98A8+2136232]
Ordinal0 [0x006F99E2+2136546]
Ordinal0 [0x00703541+2176321]
BaseThreadInitThunk [0x74FA6739+25]
RtlGetFullPathName_UEx [0x77238AFF+1215]
RtlGetFullPathName_UEx [0x77238ACD+1165]

@sdfgsdfgd
Copy link

sdfgsdfgd commented Mar 24, 2023

still not working

options = uc.ChromeOptions()
options.add_argument("--disable-extensions")
options.add_argument("--disable-gpu")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--no-sandbox")
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument("--user-data-dir=/Users/xxxxx/Library/Application Support/Google/Chrome")
options.add_argument("--profile-directory=Default")

driver = uc.Chrome(options=options)

driver.get('https://www.google.com')

same thing. It looks like it's not even attempting to get the url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants