0

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

1

1 Answer 1

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:[email protected]. It will bring a confirmation dialog.

    driver.get("http://username:[email protected]");

  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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.