browser-automation / cba

Chromium Browser Automation (extension for chrome browser automation).
https://chrome-automation.com
GNU General Public License v3.0
108 stars 16 forks source link

Automate JavaScript confirmation dialog acceptance #107

Open esteban-filardi opened 2 years ago

esteban-filardi commented 2 years ago

Is there any way to automate the acceptance of a confirm dialog that was created with JavaScript ?

I mean, dialogs created in this fashion:

window.confirm('Do you accept?');

image

esteban-filardi commented 2 years ago

I was able to make the automation work by overriding the windows.confirm method to return trueusing an inject action.

Manvel commented 8 months ago

I was able to make the automation work by overriding the windows.confirm method to return true using an inject action

This is smart!

Unfortunately there is no reliable way of clicking the native "OK" button as of my knowledge, but yeah, having confirmation trick in Functions may be a good idea. Love this trick ❤️