All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.codeborne.selenide.ex.ElementShould Maven / Gradle / Ivy

package com.codeborne.selenide.ex;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.impl.Describe;
import org.openqa.selenium.WebElement;

import static com.codeborne.selenide.ex.ErrorMessages.actualValue;

public class ElementShould extends UIAssertionError {
  public ElementShould(String searchCriteria, String prefix, Condition expectedCondition,
                       WebElement element, Exception lastError) {
    this(searchCriteria, prefix, null, expectedCondition, element, lastError);
  }

  public ElementShould(String searchCriteria, String prefix, String message, Condition expectedCondition,
                       WebElement element, Throwable lastError) {
    super("Element should " + prefix + expectedCondition + " {" + searchCriteria + "}" +
        (message != null ? " because " + message : "") +
        "\nElement: '" + Describe.describe(element) + '\'' +
        actualValue(expectedCondition, element), lastError);
  }

  @Override
  public String toString() {
    return getMessage() + uiDetails();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy