- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to open browser window in incognito/private mode using python selenium webdriver?
We can open a browser window in incognito/private mode with Selenium webdriver in Python using the ChromeOptions class. We have to create an object of the ChromeOptions class.
Then apply the method add_argument to that object and pass the parameter -- incognito has a parameter. Finally, this information has to be passed to the webdriver object.
Syntax
c = webdriver.ChromeOptions() c.add_argument("--incognito")
Example
from selenium import webdriver #object of ChromeOptions class c = webdriver.ChromeOptions() #incognito parameter passed c.add_argument("--incognito") #set chromodriver.exe path driver = webdriver.Chrome(executable_path="C:\chromedriver.exe",options=c) driver.implicitly_wait(0.5) #launch URL driver.get("https://www.tutorialspoint.com/tutor_connect/index.php")
Output
- Related Articles
- How to open a new window on a browser using Selenium WebDriver for python?
- How to open a browser window in full screen using Selenium WebDriver with C#?
- How to close child browser window in Selenium WebDriver using Java?
- How to maximize the browser window in Selenium WebDriver using C#?
- How to connect to an already open browser using Selenium Webdriver?
- How to open a link in new tab of chrome browser using Selenium WebDriver?
- How to Resize Browser Window in WebDriver?
- How to set window size using phantomjs and selenium webdriver in Python?
- How to open a new tab using Selenium WebDriver?
- How to open a link in new tab using Selenium WebDriver?
- How to hide Firefox window (Selenium WebDriver)?
- How to launch Edge browser with Selenium Webdriver?
- Capturing browser logs with Selenium WebDriver using Java.
- How does Incognito Mode work?
- How to Maximize window in chrome using webDriver (Python)?

Advertisements