I have strange problem. I want to automate one web site using Cypress. At the begining I need to enter credentials like username and password into the alert (pop-up) window. I tryed a lot of ways to handle this. Here is my code that I used for handling alert (pop-up) windows, that contains input text element:
cy.window().then(($win) => {
cy.stub($win, 'prompt').returns(text)
cy.get(#randomId).click()
})
I wasn't sure if this is the correct way to handle this, thats why I tryed one package named: cypress-ntlm-auth. I tried to use this package, because it seems that the package handles "Windows Authentication login" when visiting a site for the first time. Here is the code that I tried:
cy.ntlm(['chiquito-qa.omnifitrgsites.co.uk'], "tainae", "nekazvam", "chiquito-qa");
cy.visit('chiquito-qa.omnifitrgsites.co.uk');
Btw the credentials are not real.
CodePudding user response:
You can do something like this. This will bypass the auth pop-up and will directly authenticate.
cy.visit('https://username:[email protected]')
CodePudding user response:
I think the website use a basic authentication method to login simply use this pattern
cy.visit("http://username:[email protected]")
Or to simplify your process for other request use a base url on the cypress.json file
"baseUrl": "http://username:[email protected]"
