If you're talking about "private browsing mode" as "incognito mode", it's easy.
You can control FireFox by using GUI Scripting (via System Events).
"keystroke" command can make key press event. "click" command can make menu click event.
Whole GUI Scripting how-to is in my ebook.
https://piyomarusoft.booth.pm/items/4230018
Post
Replies
Boosts
Views
Activity
Originally, AppleScript invoked an application's internal functionality through an AppleScript dictionary of terms.
Operations such as clicking buttons and operating menus depend on the state of the application being operated, so various know-how is required.
It's normal to write out system information as CSV data.
All the know-how about GUI Scripting is summarized in an e-book, so it may be helpful.
https://piyomarusoft.booth.pm/items/4230018