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

io.github.kgress.scaffold.webelements.LinkWebElement Maven / Gradle / Ivy

There is a newer version: 3.5.0
Show newest version
package io.github.kgress.scaffold.webelements;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

/**
 * A strongly typed representation of a Link {@link WebElement}.
 */
public class LinkWebElement extends AbstractClickable {

    public LinkWebElement(By by) {
        super(by);
    }

    public LinkWebElement(By by, WebElement parentElement) {
        super(by, parentElement);
    }

    public LinkWebElement(By by, By parentBy) {
        super(by, parentBy);
    }

    public LinkWebElement(WebElement element) {
        super(element);
    }

    /**
     * Returns the link text as rendered in the UI
     *
     * @return the link as {@link String}
     */
    public String getLinkText() {
        return getWebElement().getText();
    }

    /**
     * Returns the link href (the destination URL)
     *
     * @return the link's URL as {@link String}
     */
    public String getLinkHref() {
        return getWebElement().getAttribute("href");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy