Package allurium.primitives
Class Link
java.lang.Object
allurium.primitives.UIElement
allurium.primitives.Link
- All Implemented Interfaces:
AlluriumElement,ListComponent,WebElementMeta
Represents a `Link` element in the UI, extending
UIElement.
This class is designed to encapsulate the behavior and attributes of an anchor (``) element, commonly used to navigate between pages or perform actions in a user interface.
Features:
- Encapsulates behavior and attributes of a `Link` element.
- Provides utility methods to retrieve and validate the `href` attribute.
- Supports multiple initialization methods through various constructors and static factory methods.
Purpose:
- Standardizes the interaction with link elements in the UI.
- Simplifies the creation and validation of link elements in tests.
Constructors:
Link()- Default constructor.Link(String)- Creates a `Link` using a Selenide locator string.Link(SelenideElement)- Creates a `Link` using aSelenideElement.Link(By)- Creates a `Link` using a SeleniumBylocator.Link(By, String)- Creates a `Link` using a SeleniumBylocator and a name.Link(SelenideElement, String)- Creates a `Link` using aSelenideElementand a name.Link(String, String)- Creates a `Link` using a Selenide locator string and a name.
Static Factory Methods:
$link(By)- Creates a `Link` using a SeleniumBylocator.$link(By, String)- Creates a `Link` using a SeleniumBylocator and a name.$link(SelenideElement)- Creates a `Link` from aSelenideElement.$link(SelenideElement, String)- Creates a `Link` from aSelenideElementwith a name.$link(String)- Creates a `Link` using a Selenide locator string.$link(String, String)- Creates a `Link` using a Selenide locator string and a name._$link(String)- Creates a `Link` using an XPath expression.
Usage Example:
// Creating a link using a Selenide locator
Link link = $link("a.link-class");
// Validating the href attribute
link.assertHref("https://example.com");
-
Field Summary
Fields inherited from class allurium.primitives.UIElement
assignNameMethod, description, id, parent, root, stepsConsoleLoggingEnabled, stepsReportLoggingEnabled, uiElementName, uiElementType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Linkstatic Link$link(com.codeborne.selenide.SelenideElement selenideElement) static Linkstatic Linkstatic Linkstatic Link$link(org.openqa.selenium.By locator) static LinkvoidassertHref(String href) Asserts that the `href` attribute of the link matches the expected value.href()Retrieves the `href` attribute of the link.Methods inherited from class allurium.primitives.UIElement
_$uiElement, $uiElement, $uiElement, $uiElement, $uiElement, $uiElement, $uiElement, applyName, applyName, as, assertEmpty, assertEquals, assertExists, assertExists, assertHasCssClass, assertHasCssClass, assertHasNotCssClass, assertHasNotCssClass, assertHasNotCssClass, assertHasText, assertIsNotEmpty, assertNotExist, assertNotExist, assertNotVisible, assertNotVisible, assertNotVisible, assertText, assertVisible, assertVisible, assertVisible, assertVisible, assertVisibleInViewport, click, click, click, click, click, clickAndHold, clickAndHold, clickAndHold, contextClick, contextClick, contextClick, doubleClick, doubleClick, doubleClick, get, getAllureCompiledStep, getAttribute, getHeight, getId, getStepText, getUiElementName, getWidth, hover, hover, hover, isDisplayed, logStep, logStepToReport, logStepToReport, scrollTo, scrollTo, scrollTo, setRoot, setRoot, text, verifyEmpty, verifyIsNotEmpty, wrappedNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface allurium.interfaces.AlluriumElement
getRootMethods inherited from interface allurium.interfaces.WebElementMeta
getDescription, getMetaKeys, getParent, setAssignNameMethod, setDescription, setParent, setUiElementName
-
Constructor Details
-
Link
public Link() -
Link
-
Link
public Link(com.codeborne.selenide.SelenideElement selenideElement) -
Link
public Link(org.openqa.selenium.By locator) -
Link
-
Link
-
Link
-
-
Method Details
-
$link
-
$link
-
$link
-
$link
-
$link
-
$link
-
_$link
-
href
Retrieves the `href` attribute of the link.- Returns:
- the value of the `href` attribute
-
assertHref
Asserts that the `href` attribute of the link matches the expected value.Step: Processed by Aspect
- Parameters:
href- the expected `href` value
-