0

I have the url which needs credentials and I am navigating to that through selenium + Java https://username:password.example.com/

However it still shows the login window but not as an alert window. Attached the screenshot. I tried the below code but it did not work

 UserAndPassword UP = new UserAndPassword("username","password");
 driver.switchTo().alert().authenticateUsing(UP);

Is there anyway I can do it?the page with login window

Gokul
  • 788
  • 2
  • 12
  • 30
asinha
  • 337
  • 1
  • 6
  • 24
  • 3
    Possible duplicate of [Chrome 59 and Basic Authentication with Selenium/Fluentlenium](https://stackoverflow.com/questions/44542740/chrome-59-and-basic-authentication-with-selenium-fluentlenium) – Florent B. Jun 23 '17 at 13:19

2 Answers2

2

You are missing @ symbol after user name and password. You can try like below,

https://username:password@test.discoverykidsplay.com/

Murthi
  • 5,299
  • 1
  • 10
  • 15
  • 1
    As mentioned above by @Florent B, this feature has been removed from Chrome. – demouser123 Jun 23 '17 at 13:45
  • sorry though I mentioned wrongly here but I have used @ correctly. https://username:password@test.discoverykidsplay.com/ this gives some weird css problem (https://stackoverflow.com/questions/44720113/css-distortion-while-url-gets-opened-in-chrome-through-selenium)So I thought I would try the below one (i.e http://username:password@es.testserver.test.dkids.mercury.dnitv.com/) which if i directly put in the browser manually it resolves and redirects to test.discoverykdisplay.com but if i go through selenium it shows me the login window though url gets resolved to test.discoverykidsplay.com – asinha Jun 23 '17 at 14:11
0

This provides multiple approaches for handling Authentication pop-ups.

I would suggest to use WebDriver’s switchTo.alert() syntax to access them and then use methods such as sendKeys(), accept() or dismiss()

Gokul
  • 788
  • 2
  • 12
  • 30