0

I'm writing automated tests for a website that uses pop-up authentication. I am able to provide the credentials by using the username:password@https://site.address.com formula, but in that case the Chrome window's title bar simply shows data;: and a blank page. After this, my tests will fail as the page is not really loaded and the elements can't be clicked.

If I don't provide credentials, then the title bar will show my URL, but I can't enter the credentials to enter the page, as the pop-up window has no elements I can refer to.

EDIT: when I try to send in the authentication data using driver.switchTo().alert() then the execution basically stops and I have to press cancel.

controller.getNavigator().goToPage(loginSiteAddress);
        System.out.println(userName);
        System.out.println(password);
        controller.getNavigator().authenticate(userName, password);

public void authenticate(String userName, String password) {
        driver.switchTo().alert().sendKeys(userName + Keys.TAB + password);
        driver.switchTo().alert().accept();
    }

How can I make the 1st solution work?

Zoltán Györkei
  • 1,025
  • 5
  • 13
  • 21
  • I have answered a similar question [here](https://stackoverflow.com/a/50303623/5074293) – GPT14 Jun 05 '18 at 08:17
  • Yes, I found that actually and started working based on it. Now as I see authenticateUsing is not available anymore, so I wrote a little authentication function that ought to send the characters to the login dialog. But it seems the popup stops the execution and the auth function is never called. The same problem as [here](https://stackoverflow.com/questions/24304752/how-to-handle-authentication-popup-with-selenium-webdriver-using-java). I used the last answer's solution. – Zoltán Györkei Jun 05 '18 at 08:28
  • 1
    Similar question answered here https://stackoverflow.com/a/47175309/7030563 – Rabia Asif Jun 05 '18 at 09:23

0 Answers0