Select OK button from N'th modal opened in testcafe

后端 未结 1 1239
情歌与酒
情歌与酒 2021-01-20 23:58

I open two modals in my testing, and I want to be able to click on the \"OK\" button in the second modal (the second selected element in the below html).

My current code

1条回答
  •  孤街浪徒
    2021-01-21 00:15

    did you try using nth ?

    const modalOKButton = Selector('div.ant-modal').nth(1)
            .find('div.ant-modal-footer')
            .find('button.ant-btn-primary');
    

    or maybe try using selector by aria-labelledby

    const modalOKButton = Selector("[aria-labelledby='rcDialogTitle1']")
            .find('div.ant-modal-footer')
            .find('button.ant-btn-primary');
    

    0 讨论(0)
提交回复
热议问题