undetected-chromedriver icon indicating copy to clipboard operation
undetected-chromedriver copied to clipboard

Is it possible to reconnect to existing browser?

Open kyxaxa opened this issue 2 years ago • 3 comments

Suppose I've used undetected chromedriver to start the session. After that for debugging I want to write the new function (or make some changes) that works with that opened page and test that function. I would like to reconnect to the same browser for that. How that can be done?

kyxaxa avatar Jul 09 '22 09:07 kyxaxa

It's usually done by restarting your script that should do all the things to get into that session. A chrome instance is opened for each undetected chrome your start browser = uc.Chrome() so if the script run until the end (complete), you cannot access the browser instance anymore. Same for every Python class. If you're automating someting, I really recommand you to make every action scripted from the beginning so that the script will one shot your need.

Hope I answered your question.

QuentiumYT avatar Jul 13 '22 08:07 QuentiumYT

You can either :

  • Use an interactive Jupyter Notebook.
  • Or use user_data_dir parameter to specify a folder where your entire Chrome profile will be kept between your sessions. Please check the docstring for this parameter here.

sebdelsol avatar Jul 13 '22 13:07 sebdelsol

  • Or use user_data_dir parameter to specify a folder where your entire Chrome profile will be kept between your sessions. Please check the docstring for this parameter here.

I.know how to get session ID. But how to start the same session? Which code do i have to use.

Thanks a lot!

RestOp avatar Aug 14 '22 09:08 RestOp