0

Hi i want to use selenium to open Internet Explorer-11 as different user. I have done a search and it show that it is possible but with Java, I am using Python so I am wondering is it possible with Internet Explorer webdriver or not.

For example if you right click on internet explorer, it will have the part sign in as different user. I want to automate that part with python IE webdriver, but I do not know how to do it.

what I am asking is similar to this post How to impersonate a specific user with Selenium Webdriver? but I want to do it in Python with selenium webdriver

To be clear. I know how to open the webrowser with selenium and i know how to sign in with selenium (when there is a pop up window). But I am asking about how to let selenium know that I want to sign in as different user. Because if I just open my browswer normally there is no pop up for sign in.

from selenium import webdriver
driver=webdriver.Ie()

this is the desktop that is opened by selenium- there is no pop up for sign in

Thank you

  • Have you tried anything so far? If so, please share your source code, even if its the Java version, it might help to follow the same approach in Python. – Isma Feb 06 '18 at 14:46
  • No I have not tried anything. Because I do not know how to do that in Python I can only open my internet explorer under my current username, and I am not doing it in Java. And I do not know whether it is possible to do that in Python or not. My project start by singing in to IE with different user, and now I am stuck in the very first step. So I am so sorry but I am currently got no code to share – Phuong Duyen Huynh Ngoc Feb 06 '18 at 14:47
  • What kind of different user you mean? OS or application? – Dalton Cézane Feb 06 '18 at 14:49
  • 2
    what does "open IE11 as different user" actually mean? – Corey Goldberg Feb 06 '18 at 14:50
  • @ Dalton well in the application only. For example if you right click on internet explorer, it will have the part sign in as different user. I want to automate that part with python IE webdriver, but I do not know how to do it. – Phuong Duyen Huynh Ngoc Feb 06 '18 at 14:51
  • 1
    That should be explained in your question, it is unclear what you are asking. Please read [the Stack Overflow question checklist](http://meta.stackexchange.com/q/156810/204922) – Isma Feb 06 '18 at 14:53
  • when I right click on internet explorer I don't see anywhere an option such as "sign in as different user", what do you mean exactly? When you click on the IE icon on windows or inside a Web page? In that image you posted you are not redirecting to any page. – Isma Feb 06 '18 at 15:22

2 Answers2

1

You can use Selenium Web Driver.

Learning about it you can do what you need with a code similar to this:

username = selenium.find_element_by_id("username")
password = selenium.find_element_by_id("password")

username.send_keys("YourUsername")
password.send_keys("yourPa55worD")

selenium.find_element_by_name("submit").click()

Since it seems you want to use another OS user, I suggest you use Sikuli:

Sikuli automates anything you see on the screen. It uses image recognition to identify and control GUI components. It is useful when there is no easy access to a GUI's internal or source code.

I think there is no way to do what you are wanting with just Selenium. If you need to integrate Selenium and Sikuli, you can see this post on SOF: Calling to a Sikuli script from Python (Selenium) . It can give some ideas for you.

I hope it helps.

Dalton Cézane
  • 3,672
  • 2
  • 35
  • 60
  • Thanks for your help. But when i open internet explorer, there is no pop up for sign in. I have to first to right click the internet explorer, chose run as different user, then the pop up will appear. What I am asking is how I can automate that task with selenium. – Phuong Duyen Huynh Ngoc Feb 06 '18 at 15:00
  • So, it is not an application user as you told before. It seems it is a different OS user, since you will start a process in OS (IE), not a session of an application! I will update my answer with another suggestion. – Dalton Cézane Feb 06 '18 at 16:53
-1

Download IE Drivers based on your OS (Windows 32 or 64 bit)

a. Download Windows 32 bits driver

OR

b. Download Windows 64 bits driver

Extract the zip and copy IEDriverServer.exe file to some location e.g. E:\IEDriver

Write the following script

from selenium import webdriver browser = webdriver.Ie("e:\\IEDriver\\IEDriverServer.exe")

send values your inputs 'username' and 'password' and submit.

Run the script, it should open IE browser...

JACC
  • 13
  • 5