how to login to the alert window when we navigate to the browser through selenium
问题 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? 回答1: You are missing @ symbol after user name and password. You can try like below,