Using webbrowser
module and webbrowser.open
method, we can open URL in new tab.
However, is there any way we can open a secret tab in Google by using Python?
import webbrowser
webbrowser.open_new("http://google.com")
Using webbrowser
module and webbrowser.open
method, we can open URL in new tab.
However, is there any way we can open a secret tab in Google by using Python?
import webbrowser
webbrowser.open_new("http://google.com")
You'd be better off using os.system()
to launch chrome with incognito argument.
Example: os.system("C:\path\to\chrome\executable.exe -ArgumentList @( '-incognito','https://www.google.com'")
It is possible to use the method you are using to open a 'secret tab'. Try this:
webbrowser.get("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s --incognito")
.open("<URL YOU WANT TO OPEN>")
The special part is --incognito
. It signifies incognito mode (to open a secret/incognito tab). %s
is used to signify the URL to open (specified by the .open
function). A side note: you can NOT replace %s
with your URL, or else it raises webbrowser.Error
.