Get URL of opened Firefox tabs from terminal
Don't know about all tab URLs, but since Firefox 87 you can use native AppleScript GUI scripting to get the URL of the current tab. That's because Firefox now has support for VoiceOver [1].
First enable Firefox support for VoiceOver by going to about:config
and setting the accessibility.force_disabled
property to -1
. Note that VoiceOver doesn't have to be enabled, only the support in Firefox. (Extra info at [2].)
After that, you can use the following one liner:
osascript -e 'tell application "System Events" to get value of UI element 1 of combo box 1 of toolbar "Navigation" of first group of front window of application process "Firefox"'
Also, by iterating over the windows you could get the URLs of the frontmost tab of each window...
[1]: Enabling VoiceOver support makes Firefox expose the internal structure of its window for GUI scripting.
[2]: For extra info and a non-permanent option (toggling AXEnhancedUserInterface
via AppleScript) look at this bug report.