How to handle basic authentication with protractor?

前端 未结 7 1077
长情又很酷
长情又很酷 2020-12-25 13:08

I\'m trying protractor to write a few tests in a non angular application. I have to login in a page trough basic authentication in google chrome, but i have no idea how.

7条回答
  •  礼貌的吻别
    2020-12-25 13:44

    You may use Windows Credentials Manager to avoid this pop-up being constantly shown on every attempt to log in.

    Add your credentials to the 'Generic' category there, restart browser (including background apps running).

    Some explanation I currently have: this pop-up is not 'browser' specific, it is 'in the middle', between browser and domain credentials verification. Thus browser features (save password, autofill) do not work completely. By the same reason Protractor / Selenium etc. do not have complete control over that pop-up - it is by design of the domain authentication.

    As not completely sure if it is the only reason there are some other hints: - you may also need to add your site to the IE (IE, not Chrome) list of trusted sites (Chrome grabs information from there); - check "Automatic logon with current user name and password" in IE (not Chrome) - may not work if credentials you are using for the site are different from those you use to login to the machine.

提交回复
热议问题