Could you please tell me how to automate this window using webdriver and java - https://www.screencast.com/t/Zf19fumzl1j
Asked
Active
Viewed 64 times
1 Answers
1
You can not automate the window ( for HTTP Authentication ) using selenium. You can use robot framework to automate this window. Here is the approach :
Instead of putting your url like http://yoururl.com, put it like http://username:password@yoururl.com. It will bring a confirmation dialog.
driver.get("http://username:password@yoururl.com");
To click the confirmation dialog use following code
import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; public void clikOKOfConfirmationDialog(){ try { Robot robot = new Robot(); robot.delay(2000); robot.keyPress(KeyEvent.VK_ENTER); robot.keyRelease(KeyEvent.VK_ENTER); } catch (AWTException e) { e.printStackTrace(); } }
This approach might not be work with IE. Hope this will help.

Sandipan Pramanik
- 338
- 1
- 7