Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i export html to file via command line with FireFox

Tags:

So the question explains itself very good.

Is there a console command line to save the html with firefox?

Thanks.

like image 247
Tony Avatar asked Mar 15 '13 10:03

Tony


People also ask

How do I use firefox command line?

On Windows machines, go to Start > Run, and type in "firefox -P" ​On Linux machines, open a terminal and enter "firefox -P"


1 Answers

There is no way to ask Firefox to save a page via command line (as of May 2015). There is, however, a script that can automate the process of launching Firefox, saving the page, quitting Firefox.

https://github.com/abiyani/automate-save-page-as

From the README file:

A quick hack for when wget doesn't cut it.

tl;dr Perform browser's "Save page as" (Ctrl+S) operation from command line without manual intervention

This small bash script simulates a sequence of key presses which opens a given url in the browser, save the page (Ctrl+S), and close the browser tab/window (Ctrl+F4).

# Use Firefox to open a web-page and save it in /tmp # (the default name for the file (Page title) is used) $ ./save_page_as "www.example.com" --browser "firefox" --destination "/tmp"  
like image 106
gioele Avatar answered Sep 20 '22 05:09

gioele