code: public static ExpectedCondition<Boolean> textToBeEqualsToExpectedValue(final By locator, final String value) {
          return new ExpectedCondition<Boolean>() {
              /**
               * {@inheritDoc}
               */
              @Override
              public Boolean apply(@Nullable WebDriver driver) {
                  try {
                      final WebElement element = driver.findElement(locator);
                      if (element != null && value != null) {
                          return !((element.getAttribute(VALUE) == null || !value.equals(element.getAttribute(VALUE).trim())) && !value.equals(element.getText().replaceAll("\n", "")));
                      }
                  } catch (final Exception e) {
                  }
                  return false;
              }
          };
      }
docs: Expects that the target element contains the given value as text.
  The inner text and 'value' attribute of the element are checked.
  
  @param locator
  is the selenium locator
  @param value
  is the expected value
  @return true or false