How to click the OK button in an Alert pop-up in Selenium

Use the Webdriver’s switchTo() method to switch to the alert.
You can then click its OK button with accept().

Java

Alert alert = driver.switchTo().alert();
alert.accept();

Python

alert = driver.switch_to.alert()
alert.accept()

C#

Alert alert = driver.SwitchTo().Alert
alert.Accept()