Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

I can not seem to find any documentation on how to make Selenium open the browser in incognito mode.

Do I have to set up a custom profile in the browser or?

1 Answer

0 votes
by (62.9k points)

There is a really simple way to make a window open in incognito mode:

from selenium.webdriver.chrome.options import Options

chrome_options = Options()

# incognito window

chrome_options.add_argument("--incognito")

You can also use this library for maximizing the window and more, see the documentation: https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/Chrome/Options.html

Browse Categories

...