问题
I would like to make a bash script that will iterate over different user agent options, open Firefox with the selected user agent, wait for x seconds, and then close, and loop.
Is there a command-line option for firefox
to specify the user agent?
回答1:
There is no flag for this specific purpose, but you can create a set of Firefox profiles, where each profile will specify a particular user agent.
There is an about:config option general.useragent.override, which you can specify in the user.js
file in the profile folder with a line like:
user_pref("general.useragent.extra.firefox", "Mozilla/5.0 AppleWebKit/537.36…")
You can then start Firefox with the -P flag, providing the name to the specific profile.
来源:https://stackoverflow.com/questions/42093473/how-can-i-specify-a-particular-user-agent-string-in-a-command-line-invocation-of