Skip to content Skip to sidebar Skip to footer

Select Ok Button From N'th Modal Opened In Testcafe

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 is : import

Solution 1:

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');

Post a Comment for "Select Ok Button From N'th Modal Opened In Testcafe"