Search code examples
pythonselenium-webdrivermicrosoft-edge

how to switch to windows security window and insert credentials


Here are my steps 1.Using selenium webdriver I am opening Edge

2.Then after click a link it opens popup security window. I am attaching a screenshot

enter image description here 3. I tried to switch that window using many different ways. It is not an alert because when I called for alert it says no such alerts are open.

I tried to call following but it gives error

 window_after = driver.window_handles[1]

Following two lines gave me 1 handles:

handles = driver.window_handles
print("Number of handles ", len(handles))

Output: 
Number of handles  1

if it is not alert, not a window, what is it? view source code does not print anything.

All i need is insert user name and password and then click "OK" button

  1. I put the program for sleep 20 seconds and then manually selected the cursor to user name text box. The executed following code but it does nothing

    ActionChains(driver).send_keys("Test").perform()

Side Note: Need answer for only for Microsoft Edge.


Solution

  • Selenium only works for browser automation. The Windows Security pop-up is an OS-level dialog and Selenium will not be able to recognize it. You could use third party tools like AutoIt with Selenium to automate non-browser based functionality. For the detailed steps, you could refer to this article.