简体   繁体   中英

NTLM in Cypress

I want to access a link that is protected with username and password through a windows authentication popup.

I read that this requires an NTLM plugin for Cypress. I want to access a form link https://etc.domain.com/dirlisting/notifications and here I want to login:

 it('loginpopup', () => {
    cy.ntlm(["https://etc.domain.com/dirlisting/notifications"], "Administrator", "password");
    cy.visit("https://etc.domain.com/dirlisting/notifications");
  })

I tried this code but received the following error: "Invalid host [https://etc.domain.com/dirlisting/notifications] in ntlmHosts, must be one of: 1) a hostname or FQDN, wildcards accepted. 2) hostname or FQDN with port, wildcards not accepted (localhost:8080 or www.google.com or *.acme.com are ok, https://www.google.com:443/search is not ok).

I tried also it without https.

I tried cy.visit('https://username:password@www.xyz.com') but it doesn't work.

Use cy.ntlm(["etc.domain.com"], "Administrator", "password");

instead of cy.ntlm(["https://etc.domain.com/dirlisting/notifications"], "Administrator", "password");

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