https://cypress.io logo
Third party login iframe gets stuck on submit
# i-need-help
f
Hi, i am trying to login into my application via a third-party-login form in an iframe. I can access the input fields, type in user and password etc., but shortly after i clicked on the submit button cypress seems to get stuck: nothing is logged into the bash anymore, any errormessages either. in open mode the spec window closes itself. Below you can see the code. I use the first ``cy.wait()`` to wait for the iframe to be loaded which i know is a bit ugly and wich i will replace later. Cypress seems to crash while the second ``cy.wait()`` after the form has been submitted.
Copy code
const selectors = require('../selectors');

describe('This is a first test', () => {


    const getIframeBody= () => {
        return cy
            .get(selectors.loginIFrame)
            .its('0.contentDocument.body').should('not.be.empty')
            .then(cy.wrap)
    };

    it('should login user', () => {


        cy.clearCookies();
        cy.visit('/');
        cy.get('#onetrust-accept-btn-handler').click();



        cy.wait(5000);
        getIframeBody().find(selectors.loginInputUser).type(Cypress.env('usernameForm'));
        //
        getIframeBody().find(selectors.loginInputPassword).type(Cypress.env('passwordForm'));
        getIframeBody().find(selectors.loginInputSubmit).click();

        cy.wait(5000);

    });
});
I already read serveral github discussions and stackoverflow articles, handling similar topics, but unfortunately i did not find a solution yet.