44
submitted 3 months ago* (last edited 3 months ago) by interdimensionalmeme@lemmy.ml to c/firefox@lemmy.ml

I would like to be able to perform the following actions from outside the browser, for example from a script

''' Obtain a list of all tabs, and which URL is open Obtain a list of all firefox windows and which tab is in each and in what order Obtain a list of firefox running instances Actions on tabs Close a tab Open a new tab and enter URL move a tab in a window's tab order move a tab to another window mute/unmute a tab make a tab hidden or unhide pin/unpin a tab select/unselect a tab discard a tab reload a tab copy tab body or a specific xpath run a javascript cmdlet, (bookmarklet ? ) Run a function of a script in somethingmonkey bookmarks list all bookmarks folder and bookmarks move a bookmark to another folder delete a bookmark create a bookmark get/change position of a firefox window close a window/ open a new window list installed addons turn an addon on or off '''

I would love to be able to write script, from outside firefox, and do these actions

I have found about the remote debugger, but I can't figure out if it's only for debugging firefox on android via adb ? Or can I use that directly from a script ?

https://firefox-source-docs.mozilla.org/devtools-user/about_colon_debugging/index.html#connecting-over-the-network

https://wiki.mozilla.org/Firefox_OS/Remote_Control

https://wiki.mozilla.org/Firefox/CommandLineOptions

devtools.debugger.remote-enabled -start-debugger-server ?

Is any of this possible ?

thanks !

you are viewing a single comment's thread
view the rest of the comments
[-] ahal@lemmy.ca 2 points 3 months ago
[-] interdimensionalmeme@lemmy.ml 2 points 3 months ago

Thanks that is a great lead ! So webdriver is a common interface of browser remote control.

Firefox has geckodriver which is a bridge from webdriver protocol to "marionette" which is firefox' internal remote control protocol.

Apparently, marionette is an open TCP port where you send a command and it replies in json.

I could make a batch script that uses netcat to send my commands ! I just need to figure put how to open that port and what the commands are.

[-] ahal@lemmy.ca 2 points 3 months ago* (last edited 3 months ago)

Yes, IIRC there's a pref or env that needs to be set too.. I want to say MOZ_ENABLE_MARIONETTE, but it's been awhile.

[-] ReversalHatchery@beehaw.org 1 points 3 months ago

I just need to figure put how to open that port

I'm not sure what you mean by this, but you should not need to open any ports here, especially to the internet.
Even more, if you can find a setting for it, make firefox listen only on localhost, and not on your network interfaces, because this can quickly become a security nightmare.

this post was submitted on 26 Apr 2024
44 points (94.0% liked)

Firefox

17302 readers
20 users here now

A place to discuss the news and latest developments on the open-source browser Firefox

founded 4 years ago
MODERATORS