This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

تلاش سپورٹ

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

مزید سیکھیں

firefox "screenshot" command line option

  • 8 جواب دیں
  • 1 میں یہ مسئلہ ہے
  • 2 دیکھیں
  • آخری جواب بذریعہ nealelliott1

more options

in previous versions of firefox, I was able to create screenshots with the following command line options:

/firefox.exe" -P headless --purgecaches --screenshot raw_weather.png --window-size=1920,1080 -browser "https://www.google.com/search?&q=weather+in+Washington+DC"

however, with the latest version 92.0.1, the "--screenshot" option no longer works. what has changed? what am I doing wrong?

in previous versions of firefox, I was able to create screenshots with the following command line options: /firefox.exe" -P headless --purgecaches --screenshot raw_weather.png --window-size=1920,1080 -browser "https://www.google.com/search?&q=weather+in+Washington+DC" however, with the latest version 92.0.1, the "--screenshot" option no longer works. what has changed? what am I doing wrong?

تمام جوابات (8)

more options

You may have to create a new profile for running in headless mode.

more options

Thanks, I did create a new profile and called it "headless", however I'm having the same problem.

more options

The code I posted in the above mentioned thread still works for me with the current release. So you can use this as a test to check with issues for your command line.

Note that "-screenshot" implies "-headless" (so merely -screenshot is sufficient) and your code is also missing the dash before "headless" and that might confuse Firefox. Also make sure you clear the entire profile folder as that worked best for me because headless mode seems to be quite sensitive on how to initialize a profile and a normal profile didn't work.

Location used for the main profile that keeps your personal data (Root Directory on about:profiles).

  • C:\Users\<user>\AppData\Roaming\Mozilla\Firefox\Profiles\<profile>

Location used for the disk cache and other temporary files (Local Directory on about:profiles).

  • C:\Users\<user>\AppData\Local\Mozilla\Firefox\Profiles\<profile>
more options

thanks for the additional information to try. unfortunately, this does not work as well. when I run the command with the "headless" profile that I created, firefox runs for a few seconds, then immediately exits, without an error message, and fails to write an image. is there a way that I can get more debug information while running this command?

"C:\Program Files\Mozilla Firefox\firefox.exe" -screenshot test.png https://support.mozilla.org/en-US/questions/firefox -P headless -no-remote

more options

Did you try to clear the headless profile in both locations (i.e. no files and folder left) to make it possible for Firefox headless to initialize the profile ?

You can try to run the command in a command window.

more options

yes, I cleared the profile from both local and roaming app data locations, and created a few test profiles as well. when I'm running the firefox commands, I'm using the cmd shell.

more options

I tested it with a new profile created in the current release and cleared the entire profile. The problem might be where the test.png file is saved as that is the default folder that is selected when Firefox is run and you also need write permissions to this folder. So maybe specify the full path for the screenshot image.

cor-el کی جانب سے میں ترمیمکی گئ

more options

thank you for the helpful feedback. I verified that I have permission in the directory where I want firefox to write the image file, but still no joy. the disappointing thing is that when firefox runs, it just exits without any error messages, or any clue why it fails to write the image.