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

can't run same user_data_dir again #1380

Open
Jiroun opened this issue Jul 1, 2023 · 9 comments
Open

can't run same user_data_dir again #1380

Jiroun opened this issue Jul 1, 2023 · 9 comments

Comments

@Jiroun
Copy link

Jiroun commented Jul 1, 2023

the problem is first time I run the program with user_data_dir

options = uc.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')

driver =uc.Chrome(options = options, user_data_dir="/root/Aladdin")

then I do my stuff like login or something

if I run the program again to same folder ( but this time shoud be already logged in to my website)

this problem appear

driver =uc.Chrome(options = options, user_data_dir="/root/Aladdin") File "/usr/local/lib/python3.10/dist-packages/undetected_chromedriver/__init__.py", line 443, in __init__ super(Chrome, self).__init__( File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/chrome/webdriver.py", line 49, in __init__ super().__init__( File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/chromium/webdriver.py", line 54, in __init__ super().__init__( File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 206, in __init__ self.start_session(capabilities) File "/usr/local/lib/python3.10/dist-packages/undetected_chromedriver/__init__.py", line 674, in start_session super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session( File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 291, in start_session response = self.execute(Command.NEW_SESSION, caps)["value"] File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 346, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py", line 245, 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:58797 from chrome not reachable

forget to mention _ problem happen on linux only , on windows works fine

@rafamelo01
Copy link

Same here, maybe is a port issues on Linux.

@Jiroun
Copy link
Author

Jiroun commented Jul 7, 2023

Same here, maybe is a port issues on Linux.

yes , for me I just moved to windows

@23ari
Copy link

23ari commented Jul 24, 2023

I have the same problem with a Linux docker container and natively on macOS. I only experience this issue when running in headless mode. Has anyone found a workaround or solution?

@chjtwork
Copy link

I think this problem may be related to the version of chrome, these days I have been using uc on windows, everything was fine a few days ago, now I have the same problem, the only change is that my chrome automatically updated to version 115.

@rafamelo01
Copy link

rafamelo01 commented Jul 26, 2023

In windows it is updated automatically and with that the problem is solved, is that it? Already in linux, chrome is not updated automatically and from there the problems begin to arise, do you think this is the error?

@momo286
Copy link

momo286 commented Aug 9, 2023

I have the same problem, i use UC on Ubuntu.
The solution i found is that everytime i open UC, i create a random folder, and then tell UC to use it.

basedir2=Path( __file__ ).parent.absolute().joinpath(str(''.join(random.choices(string.ascii_lowercase, k=7))))
try:
    os.mkdir(basedir2)
except:
    pass
options = uc.ChromeOptions()
driver = uc.Chrome(user_data_dir=basedir2,options=options)

@mcoliver
Copy link

The problem is the SingletonLock file. I submitted a PR for a fix here #1505 . Also be aware that if you use the substring 'headless' in your profile path, things will break. I submitted another PR #1506 to at least drop a warning about this but the logic for removing args that contain 'headless' should be updated.

@joeld1
Copy link

joeld1 commented Nov 20, 2023

I have the same issue on #1670

@lynnwho12
Copy link

get the same issue on centos docker

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

8 participants