0

I'm trying to use IE using the selenium module in python.

I want to log in with different login IDs in multiple IE windows, but the login information in IE windows is shared with each other, so independent login is not possible.

I am using selenium version is 3.6 and the explorer version is 11.

How can I fix it?

For example, when I log in to Google email in the first explorer window, when the second explorer window is turned on, I am already logged in to the Google email.

I want to log in to the same site with a different ID at the same time.

IE_1 =  ID_1 
IE_2 =  ID_2
IE_3 =  ID_3
....  
Paul Brennan
  • 2,638
  • 4
  • 19
  • 26
nathon
  • 1
  • 1
  • Try using [private mode](https://stackoverflow.com/questions/17064512/selenium-test-in-internet-explorer-in-inprivate-mode) for the browsers – goalie1998 Jan 29 '21 at 02:15

1 Answers1

0

You can achieve separate logins by running the browser in "private" mode. This is not specific to IE. You can do this in Chrome Firefox, and other browsers as well.

1. IE in private mode

From the docs, you can set "IE Command-Line Options".

Example below is directly from the documentation. I have NOT tested the below code myself as I don't have IE in my environment.

from selenium import webdriver

options = webdriver.IeOptions()
options.add_argument('-private')
options.force_create_process_api = True
driver = webdriver.Ie(options=options) # MIGHT WANT TO CHANGE

# Navigate to url
driver.get("http://www.google.com")

driver.quit()

If you don't have the $PATH set for IE, try this:

driver = webdriver.ie(executable_path="<YOUR_IE_PATH>", 
                      options=options)

2. Chrome in private mode

For Chrome, I can confirm it is valid working code. It's a simplified version of what I use myself.

from selenium import webdriver

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--incognito")

driver = webdriver.Chrome(
    executable_path="<YOUR_CHROME_DRIVER_PATH>", 
    chrome_options=chrome_options)
driver.get('https://google.com')

For the full list of acceptable "chrome_options", you can check out the reference. This link may not look "official", but it's actually referenced from the Chromedriver website (under "Recognized Capabilities" - "ChromeOptions object" - "args"), so we can safely rely on this doc.

Ziwon
  • 589
  • 6
  • 15