HTTP Basic Auth via URL in Firefox does not work?

后端 未结 8 2120
悲&欢浪女
悲&欢浪女 2020-11-30 02:18

I know that normally you can login to sites that require HTTP basic authentication with Selenium by passing the username and password in the URL, e.g.:

sele         


        
8条回答
  •  一向
    一向 (楼主)
    2020-11-30 02:44

    If you are using the FireFox Driver ... You can create a FireFox profile and save the username/pass in password manager and use an add-on to auto login. Remember if you create a FireFox or Chrome driver in Selenium, by default it uses an anonymous profile. So none of your regular extensions/add-ons/etc will be used. So it's best ot create a profile that can be distributed and saved in source control.

    1) In Windows, from the run/start menu type "firefox.exe -p" to bring up the Profile Manager and create a custom one and save it in a location with the rest of your code.

    2) Don't ask at startup is checked

    3) Download AutoAuth add-on https://addons.mozilla.org/en-US/firefox/addon/autoauth/

    4) Visit the site that requires HTTP Basic Authentication and save the credentials

    Next time you visit the site, AutoAuth will login you without the authentication required prompt showing up.

    If you have NTLM, you can modify the configuration setting to include the host names: network.automatic-ntlm-auth.trusted-uris

提交回复
热议问题