0

Could you please tell me how to automate this window using webdriver and java - https://www.screencast.com/t/Zf19fumzl1j

ils
  • 15
  • 4
  • Possible duplicate of https://stackoverflow.com/questions/11522434/how-to-handle-login-pop-up-window-using-selenium-webdriver – RNS Oct 24 '17 at 09:32

1 Answers1

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 :

  1. 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");

  2. 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.