undetected-chromedriver
undetected-chromedriver copied to clipboard
Is it possible to reconnect to existing browser?
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?
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.
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.
- 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!