Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to open chrome in incognito mode from Python

This works, in powershell:

Start-Process chrome.exe -ArgumentList @( '-incognito', 'www.foo.com' )

How can this be achieved from Python?

like image 216
3z33etm Avatar asked Jun 11 '16 22:06

3z33etm


People also ask

How do I open Chrome in Incognito Mode directly?

You can also use a keyboard shortcut to open an Incognito window: Windows, Linux, or Chrome OS: Press Ctrl + Shift + n. Mac: Press ⌘ + Shift + n.


1 Answers

Python Script to open incognito mode in chrome using webbrowser

import webbrowser
url = 'www.google.com'
chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s --incognito'
webbrowser.get(chrome_path).open_new(url)
like image 154
Vivek Kumar Avatar answered Sep 22 '22 00:09

Vivek Kumar