I am trying to get the url of active tabs of Google Chrome and other browsers.
I have tried to open the session files of Mozilla Firefox but the output of the code is getting wrong.
import json
f = open(r"C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\ad0v8pf6.defaul
t\sessionstore.js", "r")
jdata = json.loads(f.read())
f.close()
print(str(jdata["windows"][0]["selected"]))
for win in jdata.get("windows"):
for tab in win.get("tabs"):
i = tab.get("index") - 1
print(tab.get("entries")[i].get("url"))
The code returns number of current tabs that are open and their url, but I am getting output as 2 and two urls, but 5 tabs were open at that time.
I have also tried selenium but no progress.