コード例 #1
0
  /**
   * Example of clicking a button where the 1st first click does not work (possibly due to the page
   * not blocking correct) and you want to attempt additional tries. Also, example of how to use the
   * GenericFields class.
   *
   * @return some page object
   */
  public SampleDateWidget clickForgotPassword() {
    int poll = getPollInterval();
    int flakyTimeout = poll * getRetries();
    FlakinessChecks flaky = new FlakinessChecks(driver, flakyTimeout, poll);

    int retries = 1; // This could be set to any value. Also, it could be page specific.
    int count = 0;
    while (count <= retries) {
      if (count > 0) Logs.log.warn("Retry (#" + count + ") ...");

      fields.click(Field.ForgotPassword);
      boolean result = flaky.isElementRemoved(sLoc_ForgotPassword);
      if (result) return new SampleDateWidget(driver);

      count++;
    }

    Logs.logError(
        "Clicking "
            + sLog_ForgotPassword
            + " was not successful after "
            + retries
            + " retries as the element was not removed");
    return null;
  }
コード例 #2
0
 /**
  * Get the fields
  *
  * @param driver
  * @return GenericFields
  */
 private static GenericFields getFields(WebDriver driver) {
   GenericFields fields = new GenericFields(driver);
   fields.addButton(Field.ForgotPassword, sLoc_ForgotPassword, sLog_ForgotPassword, true);
   fields.verifyConfig();
   return fields;
 }