简体   繁体   中英

Cypress tests with kendo dropdown

I'm working for the first time with Cypress to automate some tests, and I'm pleased with that, but now I'm stuck on something simple.

We are using kendo to render a dropdown (in the HTML it is a standard select, with kendo-drop-down-list attribute).

In the rendered page, I can see the select item with the possible values, but it is set as not visible, so cypress cannot click and select on this.

It looks like that every time I select an option, the DOM is dynamically modified to show me the dropdown as a set of span elements, that are created on the fly.

This is what I'm doing in Cypress (where sDir is the id of the select element and firstValue is the first option of the dropdown list)

    cy.get('#sDir').select('firstValue')

Which is the right way to interact with a kendo drop down with Cypress?

Thanks

Saw some other posts related to this, but I'm using the following method to interact with kendo drop down:

cy.get('[data-container-for="YourItem"] > .k-widget > .k-dropdown-wrap > .k-select').click({force: true})
cy.get('.k-list-filter > .k-textbox').type('Value')
cy.get('k-list-scrooler').contains('Value').click()

You may have to use click({force: true})

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