Java for Selenium- Catch mulitiple exception in single Catch block

Scenario: Open Selenium Grid Online | Run Selenium Test On Cloud page As of now, till page 5 is visible until you click the next button in 5, you cannot view page 6. In Code, if you try to click page number 6 without navigating next, you may expect an Exception either ElementNotFound if there are no more pages, or ElementNotInteractableException if its hidden under the next button.

Before Java 7, we need to write an individual Catch block for every expected Exception. Now multiple exceptions can be incorporated into a single catch block.

1 Like