Selenium For Beginners

Share this post

User's avatar
Selenium For Beginners
Do not wrap the whole test script with try/catch

Do not wrap the whole test script with try/catch

to collect exceptions or screenshots

Alex Siminiuc's avatar
Alex Siminiuc
Apr 12, 2023
∙ Paid
1

Share this post

User's avatar
Selenium For Beginners
Do not wrap the whole test script with try/catch
Share

Sometimes, the whole test script is wrapped within a try/catch statement as follows:

@Test
public void searchTest() throws InterruptedException, IOException {

   try {
      driver.get(HOME_PAGE_URL);
 
      String homePageUrl = driver.getCurrentUrl();
      Assert.assertEquals(homePageUrl, HOME_PAGE_URL);

      WebElement searchBox = driver.findEleme…

Keep reading with a 7-day free trial

Subscribe to Selenium For Beginners to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Alex Siminiuc
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share