I am running Mozilla Firefox 54.0.
Given an already opened session of Firefox and multiple open tabs, is there a way for me to extract the currently active tab (the tab I am looking at) via command line?
I could not find anything in a List of command line arguments or on the Mozilla Developer page.
My question differs from this question, as it neither works the intended way for me nor do I want all the tabs; I want one specific tab, the tab I am looking at.
Does anybody have an idea?
Is there maybe a way to interface with a running instance of Firefox?
Thanks for Reading
Edit: The Solution:
import json
f= open('~/.mozilla/firefox/RANDOM.default/sessionstore-backups/recovery.js' )
jdata = json.loads(f.read())
f.close()
CurrentTab = jdata.get("windows")[0].get("tabs")[jdata["windows"][0]["selected"]-1].get("entries")[HistLen-1].get("url")
while
HistLen = len(jdata.get("windows")[0].get("tabs")[jdata["windows"][0]["selected"]-1].get("entries"))
The HistLen
was necessary because else I was always getting some older page I had previously opened in that tab.
Thanks for Reading