I'm using Selenium web driver with Java language. When there are two buttons in a popup i.e. ok and cancel , it can be easily handled with web driver using the following code:
Alert alert = driver.switchTo().alert();
alert.accept(); // or alert.dismiss(); depending upon the action you want to perform.
But what to do when there are more than two buttons, i.e. there are 3 to 4 buttons in the pop up ( e.g. like ok, cancel, try again, ignore/continue)? How can we click on whichever button that we want?