0

I've been trying to learn new stuff in Python.. each time I see something that I could "automate" and make it easier for me, I choose python to do the little scripting to learn more and more even if there is already an App or an easier way to make things work.

So, I'm a person who has a huge number of opened tabs and windows in Chrome because when I see a video on youtube that I want to see later, I put it on a tab, the same goes for studies, games, well a variety of stuff hahaha, my idea of script would be -> using chromedriver to read all my current_url from each tab while closing and saving them in a text file inside a directory (Games/Study/Videos) so I can use another script to open them up, you see, organized URLs but I could have them closed and only open them when I choose to and when I want to save or delete some tabs (you could think of this as Favorites, somehow I guess..)

My problem is, I can'T find a way to "driver = webdriver.Chrome(current_opened_chrome)".. all tutorials I've seen they always open a new window and assign it to the driver and then operate on it.

Opening all the links wouldn't be the problem, since I just need to "driver = webdriver.Chrome('chromedriver')" and operate on it, but how could I grab the URL's on a current "Chrome Window Session"?

Thank you for your time and I hope I've explained well my problem! :)

EDIT: although the solution provided, it isn't what I was looking for, I don't want to open chrome with chromedriver to save my webpages, I want to locate my already opened pages with chromedriver (if possible) so I can then save all the URL's and close the pages.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.