Skip to content

Instantly share code, notes, and snippets.

@billtaichi
Last active December 18, 2015 21:58
Show Gist options
  • Save billtaichi/5850592 to your computer and use it in GitHub Desktop.
Save billtaichi/5850592 to your computer and use it in GitHub Desktop.
Set incognito mode on selenium webdriver. (Extracted from a class)
def SetBrowserObj(self):
try:
if self.browserdriver.strip().upper() == "CHROME":
options = webdriver.chrome.options.Options()
options.add_argument("-incognito")
browser = webdriver.Chrome(chrome_options=options)
if self.browserdriver.strip().upper() == "FIREFOX":
browser = webdriver.Firefox()
self.driver = browser
except Exception as e:
self.log.error("****** Unable to load browser object error is: {0}".format(e.message))
raise e
@panchicore
Copy link

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment