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
You are missing @ symbol after user name and password. You can try like below,
https://username:password@test.discoverykidsplay.com/
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()