Chandrashekhar Swami
Chandrashekhar Swami

Reputation: 1780

How to handle Authentication pop up

Please have a look at below image

enter image description here

I need to send email, password and click on OK. I tried Action , Robot class. But did not work.

Upvotes: 0

Views: 87

Answers (2)

murali selenium
murali selenium

Reputation: 3927

As alert, Robot and username/password in URL does not work so you may need to try by creation profile and calling that if it work in this or else go for AutoIT..

I prefer, create your own firefox profile by providing name. Here is the steps

Once profile is created, navigate to URL manually and provide those authentications and Saved those. As you saved so next time if you start the same profile, it does not asks, correct?

So call that saved profile

 ProfilesIni profile = new ProfilesIni();

 FirefoxProfile myprofile = profile.getProfile("savedProfile");

  WebDriver driver = new FirefoxDriver(myprofile);

Thank You, Murali

Upvotes: 1

Shubham Jain
Shubham Jain

Reputation: 17553

you can use like below:-

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

Give your username in place of username, same for password and change example.com with your website

OR

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

Hope it will help you :)

Upvotes: 1

Related Questions