Jeffy Abraham
Jeffy Abraham

Reputation: 59

unable to access html element using cypress

I am trying to test the login functionalities using cypress, but for some reason I am unable to access the input text-box. It shows Timed out retrying after 4000ms: Expected to find element: runner container, but never found it.

describe("User authentication", () => {
    beforeEach(() => {
      cy.visit("https://lmflf.com");
     
    });
    it("it takes to the correct page", () => {
   
      cy.get('[data-field=password]')
      
    });
    
  });

Upvotes: 1

Views: 412

Answers (1)

Alapan Das
Alapan Das

Reputation: 18634

I could see a shadow DOM in your webpage and in that case you have to use .shadow()(Cypress Docs). Your code would look something like:

cy.get('view-login').shadow().find('input[data-field="username"]').type('username', {force: true})
cy.get('view-login').shadow().find('input[data-field="password"]').type('password', {force: true})
cy.get('view-login').shadow().find('input[value="personal"]').click()
cy.get('view-login').shadow().find('.ViewLogin__button').click()

Upvotes: 1

Related Questions