Python: Getting all Urls from every open Google Chrome Tab Python: Getting all Urls from every open Google Chrome Tab google-chrome google-chrome

Python: Getting all Urls from every open Google Chrome Tab


If you want to access the database, you should close all browsers.

(Source)


When we're accessing the SQLite database of any browser, we have to close that particular browser first.

Moreover, the SQL command being used here will fetch all the duplicate rows.

Need to change `select_statement'

select_statement = "SELECT distinct urls.url, urls.visit_count FROM urls, visits WHERE urls.id = visits.url;"

Further, we need to add a loop to print all the 'urls' from history database of chrome.

for url, count in results:    print(url)  # print urls line by line

However, this will give us the whole history of the Chrome browser but not the required URLs of all the presently opened tabs.