Home > Enterprise >  Not able to find the locator which is inside a component in Cypress
Not able to find the locator which is inside a component in Cypress

Time:03-04

I am trying to find the dropdown-arrow locator. I have used the cypress cmd - cy.get('.dropdown-arrow').click() but it gives element not found error.

Here is my code

<widgets-bms-scoreboard>
    <div >
        <div >
            <div >
                <div >
                    <div > </div>
                </div>  
            </div>
        </div>
    </div>  
</widgets-bms-scoreboard>

CodePudding user response:

From comments, shadow DOM is present. You can access elements within it either by adding this to cypress.json

{
  "includeShadowDom": true
}

or in the test

cy.get('widgets-bms-scoreboard')
  .shadow()
  .find('.dropdown-arrow').click()
  • Related