Search code examples
pythonbrowserincognito-mode

Python\Opera incognito\ private mode


I can not seem to find any documentation on how to open Opera in incognito mode

Could anyone help me with this please?

this is the part of code i need to include to open opera , but i have no idea how to inlcude the incognito mode

`import os
 import webbrowser


os.startfile(C:\\Program Files\\Opera\\launcher.exe)
webbrowser.open`

Solution

  • Use os or subprocess to run the opera luncher with argument --private

    somthing like this:

    "C:\<path to opera folder>\Opera\launcher.exe" --private
    

    Full code:

    import subprocess
    
    
    command = r'"C:\<path to opera folder>\Opera\launcher.exe" --private'
    subprocess.Popen(command)