code: public static By getFindElementType(String locator) {
          logger.entering(locator);
          Preconditions.checkArgument(StringUtils.isNotBlank(locator), INVALID_LOCATOR_ERR_MSG);
          By valueToReturn = null;
          String seleniumLocator = locator.trim();
          int typeDelimiterIndex = seleniumLocator.indexOf('=');
          String locatorType = typeDelimiterIndex != -1 ? seleniumLocator.substring(0, typeDelimiterIndex) : seleniumLocator;
          switch (locatorType) {
          case "id":
              valueToReturn = By.id(seleniumLocator.substring(typeDelimiterIndex + 1));
              break;
          case "name":
              valueToReturn = By.name(seleniumLocator.substring(typeDelimiterIndex + 1));
              break;
          case "link":
              valueToReturn = By.linkText(seleniumLocator.substring(typeDelimiterIndex + 1));
              break;
          case "xpath":
              valueToReturn = By.xpath(seleniumLocator.substring(typeDelimiterIndex + 1));
              break;
          case "css":
              valueToReturn = By.cssSelector(seleniumLocator.substring(typeDelimiterIndex + 1));
              break;
          case "classname":
              valueToReturn = By.className(seleniumLocator.substring(typeDelimiterIndex + 1));
              break;
          default:
              if (seleniumLocator.startsWith("/") || seleniumLocator.startsWith("./")) {
                  valueToReturn = By.xpath(seleniumLocator);
                  break;
              }
              valueToReturn = new ByIdOrName(seleniumLocator);
          }
          if (logger.isLoggable(Level.FINE)) {
              String msg = valueToReturn.getClass().getSimpleName()
                      + " will be the location strategy that will be used for locating " + seleniumLocator;
              logger.log(Level.FINE, msg);
          }
          logger.exiting(valueToReturn);
          return valueToReturn;
      }
docs: Detects Selenium {@link org.openqa.selenium.By By} type depending on what the locator string starts with.
  
  @param locator
  String that represents the means to locate this element (could be id/name/xpath/css locator).
  @return {@link By} sub-class that represents the actual location strategy that will be used.