简体   繁体   中英

Username and Password not being entered for Authentication popup using ntlm plugin

I have installed and configured the cypress-ntlm-auth plugin in order to enter the Username and Password for a Sign In popup on a test site. I was initially getting the 401 Unauthorised Error but no longer get this Error and the Sign In popup is is visible when running npx cypress-ntlm open and then running test in Cypress UI. 在此处输入图像描述

在此处输入图像描述 在此处输入图像描述

In your test You can directly use this, without any plugin:

cy.visit('https://username:password@yourwebsite.net')

Or, if you want to use env variable for username and password you can do:

cy.visit('https://' + Cypress.env('username') + ':' + Cypress.env('password') + '@yourwebsite.net')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM