If the automatic JS dialog pressing does not work (e. g. on complex websites) you can automate by switching to desktop automation and use XClick | Image_of_blue_OK_button.png
Here is a live (pixelated) video snippet of an internal Enterprise RPA automation use case (automated downloads of reports overnight) that uses this method. It clicks a JS dialog that warns that the generated report will be large: