Explain how you will login into any site if it is showing any authentication popup for username and password using Selenium WebDriver?

If its Window popup then we have to use Robot Class or AutoIT. For Web Based popup, we need to use the explicit command and verify if the alert is actually present. Only if the alert is present, we need to pass the username and password credentials. The sample code for using the explicit wait command and verifying the alert is below:

WebDriverWait wait = new WebDriverWait(driver, 10); 
Alert alert = wait.until(ExpectedConditions.alertIsPresent()); 
alert.authenticateUsing(new UserAndPassword(**username**, **password**))