Python+selenium+firefox NTLM authentication with pop(alert) window issue

Viewed 1413

I've already tried three ways, and only the first way can work.

  1. Add user information in front of url, and this is the only way success.

    url_address = "http://username:passwd@abc.cde.com/" browser = webdriver.Firefox() browser.get(url_address)

2.Second way is use .switch_to_alert() to switch to pop window and use send_keys() to key in user information, it work just fine until send_key(Keys.TAB) have used; It will TAB the input maker into password field but when send_key("password") line, It jumps back to username field and then key in password! I have make a Demo gif link below.
Demo with Key.TAB

browser = webdriver.Firefox()
browser.get(url_address)
WebDriverWait(browser,10).until(EC.alert_is_present(),"wait for alert pop out")
alert_window=browser.switch_to_alert()
alert_window.send_keys("username")
time.sleep(5)
alert_window.send_keys(Keys.TAB)
time.sleep(5)
alert_windows.send_keys("passwd")

time.sleep is in order to know if TAB really work or not. Same result if it removed

Update 11/14 change send_keys to one line and it work as expect Like this alert_window.send_keys("username"+Keys.TAB+"passwd")

3.Third way is use alert_window.authenticate()but it return

selenium.common.exceptions.WebDriverException: Message: POST /session/c7411dfa-5a0e-41e3-b8b3-e8f7d9dc9843/alert/credentials did not match a known command

Any idea to fix issue on 2 and 3 ? tool list : python 3.6.2 selenium firefox 54.0.1 (32 bit)

0 Answers
Related