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. Commented Sep 15, 2017 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
    Commented Sep 15, 2017 at 21:20
  • Simulate exactly what user does to login to your website: go to URL, fill login form, submit. Is your website different? Commented Sep 15, 2017 at 21:36
  • I am talking about the basic auth on browser level, not the app itself @peter
    – Marj
    Commented Sep 16, 2017 at 14:22

1 Answer 1


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
    Commented Sep 19, 2017 at 15:41
  • 1
    @Marj any luck bypassing basic authentication? Commented May 20, 2021 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
    Commented Jul 21, 2021 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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