1

Authentication window snap

Already tried following methods,

1) https://username:[email protected]

My username contains '\' thats why it is giving problem.

2) switch to alert method In this I am getting 'No alert' Exception

Please help in these cases/ Suggest any other method to handle windows authentication with python...

4
  • You should try to url encode the back slash. Otherwise, your site seems to not want you to automate or Web scrape against it Commented Jun 10, 2016 at 14:38
  • Does any of these help? stackoverflow.com/questions/10395462/… ; stackoverflow.com/questions/24304752/… ? Commented Jun 10, 2016 at 23:44
  • By using encode value of '\', it's working.... Commented Jun 29, 2016 at 7:29
  • You should post this as an answer and accept it so others can see that your problem was solved, especially if you solved it yourself :) Commented Jul 11, 2016 at 4:26

1 Answer 1

2

Install win32com.client and then try the below code

from selenium import webdriver
import time
import win32com.client

driver=webdriver.Firefox()
driver.maximize_window()
driver.get('url')
shell = win32com.client.Dispatch("WScript.Shell")   
shell.Sendkeys("username")  
shell.Sendkeys("{TAB}")
shell.Sendkeys("password") 
shell.Sendkeys("{ENTER}")
time.sleep(5)
driver.quit()
Sign up to request clarification or add additional context in comments.

1 Comment

just watch out that you don't click anywhere else in Windows, because the text will be sent wherever you have your cursor!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.