code: public static String switchToLastTab() {
          int totalTabs;
          int time = 0;
          do {
              Utils.sleep(100L);
              totalTabs = getCountTabs();
              time++;
          } while (totalTabs <= 1 && time < 10);
          return switchToTab(totalTabs - 1);
      }
docs: Switch driver to last browser tab
  
  @return oldTabName