1

I'm using Selenium WebDriver to automate testing, but I'm encountering issues when I try to code the login. The authentication is acting as an alert in Firefox, not as a window, which means that I can't access the username and password fields. How do I handle this so I can access the fields?

I'm using Selenium 3, Java 8 and Firefox 46 on a Linux virtual machine. Unfortunately, I can't post any code per my company's policy.

  • As you can't paste code it's difficult for me to know what's actually happening. At first glance to me it sounds like Firefox asks for basic authentication? I mean it's not really part of the website your testing, is it? – user1130 Feb 28 '17 at 7:08
2

If you can try with firefox version 47+ as Selenium 3 is supported with later version from v47. Here is the link for reference

Hope the below solution can help you with Authentication Alert box -

using "selenium.security.UserAndPassword" library

UserAndPassword uAp = new UserAndPassword(userName, password);
driver.switchTo().alert().authenticateUsing(uAp);

OR

alert.authenticateUsing(new UserAndPassword(userName, password));

Reference StackExchange here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.