code: @SuppressWarnings("unchecked")
      public void click(Object... expected) {
          dispatcher.beforeClick(this, expected);
  
          getElement().click();
          if (Boolean.parseBoolean(Config.getConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING))) {
              logUIAction(UIActions.CLICKED);
          }
          // If there are no expected objects, then it means user wants this
          // method to behave as a clickonly. So lets skip processing of alerts and leave
          // that to the user.
          if (expected == null || expected.length == 0) {
              return;
          }
          if (parent != null) {
              WebDriverWaitUtils.waitUntilPageIsLoaded(parent.getCurrentPage());
          }
          validatePresenceOfAlert();
          try {
              for (Object expect : expected) {
                  if (expect instanceof AbstractElement) {
                      AbstractElement a = (AbstractElement) expect;
                      WebDriverWaitUtils.waitUntilElementIsPresent(a.getLocator());
                      continue;
                  }
                  if (expect instanceof String) {
                      String s = (String) expect;
                      WebDriverWaitUtils.waitUntilElementIsPresent(s);
                      continue;
                  }
                  if (expect instanceof ExpectedCondition<?>) {
                      long timeOutInSeconds = Grid.getExecutionTimeoutValue() / 1000;
                      WebDriverWait wait = new WebDriverWait(Grid.driver(), timeOutInSeconds);
                      wait.until(ExpectedCondition.class.cast(expect));
                      continue;
                  }
                  if (expect instanceof WebPage) {
                      WebDriverWaitUtils.waitUntilPageIsValidated((WebPage) expect);
                      continue;
                  }
              }
          } finally {
              // Attempt at taking screenshots even when there are time-outs triggered from the wait* methods.
              processScreenShot();
  
              dispatcher.afterClick(this, expected);
          }
      }
docs: The click function and wait for expected {@link Object} items to load.
  
  @param expected
  parameters in the form of an element locator {@link String}, a {@link WebPage}, an
  {@link AbstractElement}, or an {@link ExpectedCondition}