Showing posts with label Handling authentication PopUp using Selenium. Show all posts
Showing posts with label Handling authentication PopUp using Selenium. Show all posts

How to handle Authentication PopUp using Selenium?

Sometime we have to automate websites which shows authentication Pop Up like mentioned below:











In order to automate this PopUp, we will pass UserId and Password via URL:

http://username:password@anytestwebsite.com

Java Script:

String URL = "http://" + username + ":" + password + "@" + anytestwebsite.com;
driver.get(URL);
Alert alert = driver.switchTo().alert();
alert.accept();