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

com.codeborne.selenide.appium.conditions.AttributeWithValue Maven / Gradle / Ivy

There is a newer version: 7.5.1
Show newest version
package com.codeborne.selenide.appium.conditions;

import com.codeborne.selenide.CheckResult;
import com.codeborne.selenide.Driver;
import com.codeborne.selenide.WebElementCondition;
import org.openqa.selenium.WebElement;

public class AttributeWithValue extends WebElementCondition {
  private final CombinedAttribute attribute;
  protected final String expectedAttributeValue;

  public AttributeWithValue(CombinedAttribute attribute, String expectedAttributeValue) {
    super(String.format("attribute %s=\"%s\"", attribute, expectedAttributeValue));
    this.attribute = attribute;
    this.expectedAttributeValue = expectedAttributeValue;
  }

  @Override
  public CheckResult check(Driver driver, WebElement element) {
    String attributeValue = attribute.getAttributeValue(driver, element);
    return new CheckResult(
      expectedAttributeValue.equals(attributeValue),
      String.format("%s=\"%s\"", attribute, attributeValue)
    );
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy