I have been researching about how to bypass browser authentication in Safari 10 (or Chrome) in Mac OS Sierra. I have tried the following: http://username:password@URLofAPP I have also tried: alert.SetAuthenticationCredentials(username,password); alert.accept(); and it won't work. Currently using Selenium 3.3 and Safari 10

  • Why you are trying to bypass it? You have selenium, you can simulate user logging in. Sep 15 '17 at 20:00
  • I am not sure how to get into the browser alert authentication that safari is throwing. I have done some steps to do it which is the alert.setauthenticationcredentials but I couldn't get into it
    – Marj
    Sep 15 '17 at 21:20
  • Simulate exactly what user does to login to your website: go to URL, fill login form, submit. Is your website different? Sep 15 '17 at 21:36
  • I am talking about the basic auth on browser level, not the app itself @peter
    – Marj
    Sep 16 '17 at 14:22

It can't be done in Selenium (outside of Java's Robot class), but you can configure your test system(s) to login using Apple's Keychain as this SuperUser answer points out. As a follow up answer points out, you can do wildcard matches on the domains now.

  • I was looking at Applescript where I can just call this method and so when my code detects it is a safari browser I'm testing, the applescript is automatically executed
    – Marj
    Sep 19 '17 at 15:41
  • 1
    @Marj any luck bypassing basic authentication? May 20 '21 at 19:39
  • @RiteshKarwa No I didn'thave any luck. Per kirbycope's answer superuser.com/questions/343231/… this may help. I did not continue my automation testing due to Professional reasons.
    – Marj
    Jul 21 '21 at 23:32

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.