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

USER DATA DIR CRASH #1639

Open
MakDon opened this issue Oct 30, 2023 · 1 comment
Open

USER DATA DIR CRASH #1639

MakDon opened this issue Oct 30, 2023 · 1 comment

Comments

@MakDon
Copy link

MakDon commented Oct 30, 2023

I am facing a problem similar with #1567
My Chrome version:

Google Chrome | 118.0.5993.117 (Official Build) (arm64)

my code:

user_data_path = "my user data dir"
self.driver = uc.Chrome(user_data_dir=user_data_path, debug=True)
self.driver.get(url)

When I run the code, what happens is:

  • The Chrome has successfully been run with Command Line, without opening the target url:
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --user-data-dir=<my user data dir> --remote-debugging-host=127.0.0.1 --remote-debugging-port=54805 --lang=en-US --no-default-browser-check --no-first-run --no-sandbox --test-type --window-size=1920,1080 --start-maximized --no-sandbox --log-level=0 --flag-switches-begin --flag-switches-end
  • the Python code crashes after timeout, throwing Message: unknown error: cannot connect to chrome at 127.0.0.1:60256 Exception

What I found is that the debug port from chrome://version/ is different from the port of the Exception message:

  • --remote-debugging-port=54805
  • cannot connect to chrome at 127.0.0.1:60256

Is it the reason why the code crashes?

@MakDon
Copy link
Author

MakDon commented Oct 30, 2023

It seems that the remote debugging port is saved into user_data_dir files so it would use the same port in every boot, but the undetected-chromedriver would use a random free port instead, which causes this issue.

My workaround is, explictly explicitly set the port using:
self.driver = uc.Chrome(user_data_dir=user_data_path, debug=True, port=54805)

And it works as far as I could see.

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

1 participant