title: How to use switch case in selenium to test several web element in a page?
body: <p>i have a webpage with several element to be tested.
  They are more than 100 and i could not write 100 code to test one element.
  Is it possible to use switch case to test the element i want and not all.</p>
  
  <p>For example here i have 3 tests to be executed, what i want is to test only Test1 and Test2, how can i do this using switch case in java, because i have more than 100 tests to be executed, i want to use only one code.</p>
  
  <p>Thank you</p>
  
  <pre><code> //TEST1
      try {
          driver.findElement(By.xpath(CmpList._google)).isDisplayed();
          System.out.println("Google Tab exists");
          driver.findElement(By.xpath(CmpList._google)).click();
  
          } catch (NoSuchElementException e) {
          System.out.println("TEST FAILED--Google Tab element does not exist");
          } finally {
          System.out.println("Continue");
          }
  
  
      //TEST2
          try {
          driver.findElement(By.xpath(CmpList._radio)).isDisplayed();
          System.out.println("Radio Tab element exists");
          driver.findElement(By.xpath(CmpList._radio)).click();
  
          } catch (NoSuchElementException e) {
          System.out.println("TEST FAILED--Radio Tab element does not exist");
          } finally {
          System.out.println("Continue");
          }
  
   //TEST3
      try {
          driver.findElement(By.xpath(CmpList._yahoo)).isDisplayed();
          System.out.println("Google Tab exists");
          driver.findElement(By.xpath(CmpList._yahoo)).click();
  
          } catch (NoSuchElementException e) {
          System.out.println("TEST FAILED--Yahoo Tab element does not exist");
          } finally {
          System.out.println("Continue");
          }
  </code></pre>