I am trying to handle "Authentication required" using selenium webdriver.
Selenium - 2.39
Firefox - 25.0.1
OS - Linux
I understand that there are solutions available to handle this dialog (AutoIT etc). But i am looking at the possibility of using java awt Robot class. In fact it works for me if i use this API.
Scenario:
1- Open URL
2- Authentication required window opens
3- Wait till the alert is present (wait.until(ExpectedConditions.alertIsPresent())
4- Use Robot to send keys
Step 4 can send correct or incorrect credentials. If incorrect credentials are sent, authentication window pops up again.
All the above works.
Issue is like this:
- ExpectedConditions.alertIsPresent takes almost 3 minutes to execute. I guess internally it will use driver.switchTo.alert(). I tried using this call as well. But no use - it takes equal amount of time.
I am using WebDriverWait with 30 seconds timeout. So i expect that in case, it is unable to find the alert, it should time out. But it doesnt.
And just to add - When i monitor the test execution - i find that the login window is open but webdriver takes time to switch to it.
Any suggestions to overcome this?