com.slickqa.webdriver.finders.FindByHrefContains Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of slick-webdriver-java Show documentation
Show all versions of slick-webdriver-java Show documentation
This is a wrapper and utilities for using webdriver / selenium in Java.
package com.slickqa.webdriver.finders;
import java.util.ArrayList;
import java.util.Arrays;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
/**
*
* @author slambson
*/
public class FindByHrefContains extends AbstractFindByParentBy
{
private String hrefContainsText;
public FindByHrefContains(String hrefContainsText)
{
this.hrefContainsText = hrefContainsText;
}
@Override
public boolean matches(WebElement e)
{
String attrValue = e.getAttribute("href");
return attrValue != null && attrValue.contains(hrefContainsText);
}
@Override
public ArrayList getParentBy()
{
return new ArrayList(Arrays.asList(tagName("a")));
}
@Override
public String toString()
{
return String.format("By href attribute containing '%s'.", hrefContainsText);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy