I'm trying to click one button ,it will show alert message and then I want to accept that alert message. This is step I want to automate. I'm facing issue because two buttons having same class name. So my code is click on my desired button say button1, then accept alert and then again click on another button say button2(which has same class name).
My HTML code is like: for button1(on which I want to click) Mark Paid
for button2(code is clicking but I don't want to click) Bulk Paid
Now here is my automation script : async clickMarkPaid(){
page.on('dialog', async dialog => {
console.log(dialog.message());
await dialog.accept();
});
await page.click('button[class="btn-success btn-xs mark-paid"]');
}
Help me guys. I'm stuck with this point from last 2 days.
Aucun commentaire:
Enregistrer un commentaire