Class WebDriverElementValidationsBuilder

java.lang.Object
com.shaft.validation.internal.WebDriverElementValidationsBuilder

public class WebDriverElementValidationsBuilder extends Object
  • Constructor Details

    • WebDriverElementValidationsBuilder

      public WebDriverElementValidationsBuilder(ValidationEnums.ValidationCategory validationCategory, org.openqa.selenium.WebDriver driver, org.openqa.selenium.By locator, StringBuilder reportMessageBuilder)
  • Method Details

    • exists

      public ValidationsExecutor exists()
      Use this to check that the target element exists
      Returns:
      a ValidationsExecutor object to set your custom validation message (if needed) and then perform() your validation
    • doesNotExist

      public ValidationsExecutor doesNotExist()
      Use this to check that the target element does not exist
      Returns:
      a ValidationsExecutor object to set your custom validation message (if needed) and then perform() your validation
    • matchesReferenceImage

      public ValidationsExecutor matchesReferenceImage()
      Use this to check that the target element matches a reference image (using the Artificial Intelligence library SHUTTERBUG). On the first test run this method will take a screenshot of the target element and the test will pass, and on following runs the element will be compared against that reference image. The reference images are stored under src/test/resources/DynamicObjectRepository for later maintenance
      Returns:
      a ValidationsExecutor object to set your custom validation message (if needed) and then perform() your validation
    • matchesReferenceImage

      public ValidationsExecutor matchesReferenceImage(ValidationEnums.VisualValidationEngine visualValidationEngine)
      Use this to check that the target element matches a reference image.
      Parameters:
      visualValidationEngine - the selected visualValidationEngine that will be used to perform the image comparison
      Returns:
      a ValidationsExecutor object to set your custom validation message (if needed) and then perform() your validation
    • doesNotMatchReferenceImage

      public ValidationsExecutor doesNotMatchReferenceImage()
      Use this to check that the target element does not match a reference image (using the Artificial Intelligence library OpenCV). On the first test run this method will take a screenshot of the target element and the test will pass, and on following runs the element will be compared against that reference image. The reference images are stored under src/test/resources/DynamicObjectRepository for later maintenance
      Returns:
      a ValidationsExecutor object to set your custom validation message (if needed) and then perform() your validation
    • doesNotMatchReferenceImage

      public ValidationsExecutor doesNotMatchReferenceImage(ValidationEnums.VisualValidationEngine visualValidationEngine)
      Use this to check that the target element does not match a reference image.
      Parameters:
      visualValidationEngine - the selected visualValidationEngine that will be used to perform the image comparison
      Returns:
      a ValidationsExecutor object to set your custom validation message (if needed) and then perform() your validation
    • attribute

      public NativeValidationsBuilder attribute(String elementAttribute)
      Use this to check against a certain element attribute
      Parameters:
      elementAttribute - the target element attribute that will be checked against
      Returns:
      a NativeValidationsBuilder object to continue building your validation
    • isSelected

      public ValidationsExecutor isSelected()
      Use this to check against the provided elements selected attribute
      Returns:
      a NativeValidationsBuilder object to continue building your validation
    • isChecked

      public ValidationsExecutor isChecked()
      Use this to check against the provided elements checked attribute
      Returns:
      a NativeValidationsBuilder object to continue building your validation
    • isVisible

      public ValidationsExecutor isVisible()
      Use this to check against the provided elements hidden attribute
      Returns:
      a NativeValidationsBuilder object to continue building your validation
    • isEnabled

      public ValidationsExecutor isEnabled()
      Use this to check against the provided elements disabled attribute
      Returns:
      a NativeValidationsBuilder object to continue building your validation
    • isNotSelected

      public ValidationsExecutor isNotSelected()
      Use this to check against the provided elements selected attribute
      Returns:
      a NativeValidationsBuilder object to continue building your validation
    • isNotChecked

      public ValidationsExecutor isNotChecked()
      Use this to check against the provided elements checked attribute
      Returns:
      a NativeValidationsBuilder object to continue building your validation
    • isHidden

      public ValidationsExecutor isHidden()
      Use this to check against the provided elements hidden attribute
      Returns:
      a NativeValidationsBuilder object to continue building your validation
    • isDisabled

      public ValidationsExecutor isDisabled()
      Use this to check against the provided elements disabled attribute
      Returns:
      a NativeValidationsBuilder object to continue building your validation
    • text

      public NativeValidationsBuilder text()
      Use this to check against the provided elements text attribute
      Returns:
      a NativeValidationsBuilder object to continue building your validation
    • textTrimmed

      public NativeValidationsBuilder textTrimmed()
      Use this to check against the provided elements text attribute after it's trimmed (all leading and trailing space removed)
      Returns:
      a NativeValidationsBuilder object to continue building your validation
    • cssProperty

      public NativeValidationsBuilder cssProperty(String elementCssProperty)
      Use this to check against a certain element attribute
      Parameters:
      elementCssProperty - the target element css property that will be checked against
      Returns:
      a NativeValidationsBuilder object to continue building your validation