1

So I have a page that I need to test with selenium, it recently has been changed to use alert popup authentication (If you don't know what I'm talking about then check this.

My current approach is pretty much 3. approach from the link above, but I use Actions to send keys instead of just finding elements.

browser.get(url)
Alert alert = browser.switchTo().alert();
Actions action = new Actions(browser)
action.sendkeys(user).sendkeys(Keys.tab).sendkeys(password).perform()
alert.accept()

the problem starts right at the first line, it gets stuck there... Seems like selenium/chromedriver doesn't detect that page is loaded and it can proceed to next line.

I know this for sure because when I try to print something after first line, it never get printed and eventually (an eternity later) it throws me TimeOutException.

Any suggestions?

Using latest: Selenium 3.11.0 ChromeDriver 2.38 Google Chrome 66

Slow N Stupid
  • 13
  • 2
  • 4

1 Answers1

1

the pop-up is not a part of browser, it belongs to OS, that's why is not accessible via selenium

just put your credentials direct to URL, see Automating Authentication popup in Selenium

pburgr
  • 1,722
  • 1
  • 11
  • 26
  • Yes, totally forgot about this issue I raised on stackoverflow... I found out that what you say is 100% complete true. You can break the timeout chromedriver gives you and regain control, but selenium/chromedriver will still not detect this authentication popup as alert popup because it is not... I will mark this as an answer and below are a workaround I've discovered (could not use direct url to login, because it was not implemented to our test website). Workaround: Before triggering authentication popup, you make a separate thread and invoke robot to type login and password – Slow N Stupid May 12 '18 at 23:31