Dec 9, 2019 in Testing

Q: Explain how you will log in into any site if it is showing any authentication popup for username and password?

1 Answer

Dec 9, 2019
If there is a pop up for logging in, we need to use the explicit command and verify if the alert is actually present. The below code helps you understand the use of explicit wait command.




WebDriverWait wait = new WebDriverWait(driver, 10);

Alert alert = wait.until(ExpectedConditions.alertIsPresent());

alert.authenticateUsing(new UserAndPassword(**username**, **password**));
Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

Apr 18 in Git Slack Integration
Aug 4 in Matlab
Jun 24, 2019 in Testing