如何在赛普拉斯的所有下拉菜单中单击多个下拉菜单和 select 相同的值

How to click on multiple dropdown & select same values from all dropdown in cypress

我可以点击所有下拉菜单,但无法 select 从中一一获取值。

cy.xpath('/html/body/app-root/div/mat-sidenav-container/mat-sidenav-content/app-configurable-product-management/form/div[2]/mat-card/mat-card-content/app-configurable-product-inventory/form/div/div/div/div')
            .each($row => {
                //Click on drop down
                cy.wrap($row).find(':nth-child(4) > .common-form-field-width > .mat-form-field-wrapper > .mat-form-field-flex > .mat-form-field-infix').click({timeout: 2000, force:true})
                //Select same values from all dropdown (Not working)
                cy.contains('In Stock').click({timeout: 2000, force:true})
                cy.wait(2000)
            })

现在可以使用了...

cy.xpath('/html/body/app-root/div/mat-sidenav-container/mat-sidenav-content/app-configurable-product-management/form/div[2]/mat-card/mat-card-content/app-configurable-product-inventory/form/div/div/div/div')
                .each($row => {
                    cy.wrap($row).find('mat-select').then((sel) => {
                        cy.wrap(sel).click()
                    })
                    cy.get('mat-option[value="IN"]').click()
                    cy.wait(2000)
                })