Can you please share the code snippet to accept pop-ups?

Can you please share the code snippet to accept pop-ups?

Hey Noah,

This is how you can do it:

Alert alert = driver.switchTo().alert(); // switch to alert
String alertMessage= driver.switchTo().alert().getText(); // capture alert message
System.out.println(alertMessage); // Print Alert Message
Thread.sleep(5000);
alert.accept();