Package allurium.carousels
Class Carousel
java.lang.Object
allurium.primitives.UIElement
allurium.AbstractWidget
allurium.carousels.AbstractCarousel
allurium.carousels.Carousel
- All Implemented Interfaces:
AlluriumElement,ListComponent,WebElementMeta
Represents a concrete implementation of the
AbstractCarousel class for image sliders or carousels.
The `Carousel` class encapsulates the behavior and structure of a carousel component with forward and backward
navigation buttons. It extends the functionality provided by the base AbstractCarousel.
Features:
- Encapsulates the forward and backward navigation buttons as
Buttoncomponents. - Implements the
scrollForward()andscrollBackward()methods for navigation. - Supports initialization with various locator and element types for flexibility.
Purpose:
- Provides a standardized implementation of a carousel component with dynamic navigation.
- Enhances testability and reusability of carousel components in UI automation.
Usage Example:
Carousel imageCarousel = new Carousel(
By.cssSelector(".carousel"),
By.cssSelector(".next-button"),
By.cssSelector(".back-button")
);
imageCarousel.scrollForward(); // Navigate to the next set of images.
imageCarousel.scrollBackward(); // Navigate to the previous set of images.
Integration:
- Extends
AbstractCarouselto inherit common carousel behaviors. - Encapsulates navigation buttons as
Buttonelements, annotated withNamefor identification. - Supports interaction through Selenium locators or
SelenideElementinstances.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ButtonThe button used to scroll the carousel backward.protected ButtonThe button used to scroll the carousel forward.Fields inherited from class allurium.primitives.UIElement
assignNameMethod, description, id, parent, root, stepsConsoleLoggingEnabled, stepsReportLoggingEnabled, uiElementName, uiElementType -
Constructor Summary
ConstructorsConstructorDescriptionCarousel(com.codeborne.selenide.SelenideElement selenideRootElement, com.codeborne.selenide.SelenideElement buttonNextElement, com.codeborne.selenide.SelenideElement buttonBackLocator) Constructor to initialize the carousel withSelenideElementinstances for the root and navigation buttons.Carousel(String selenideRootLocator, String buttonNextSelenideLocator, String buttonBackSelenideLocator) Constructor to initialize the carousel with Selenide locator strings for the root and navigation buttons.Carousel(org.openqa.selenium.By buttonNextLocator, org.openqa.selenium.By buttonBackLocator) Constructor to initialize the carousel with SeleniumBylocators for navigation buttons.Carousel(org.openqa.selenium.By rootLocator, org.openqa.selenium.By buttonNextLocator, org.openqa.selenium.By buttonBackLocator) Constructor to initialize the carousel with SeleniumBylocators for the root and navigation buttons. -
Method Summary
Modifier and TypeMethodDescriptionvoidScrolls the carousel backward by clicking the "Back" button.voidScrolls the carousel forward by clicking the "Next" button.Methods inherited from class allurium.AbstractWidget
getHeight, getRoot, getWidth, setRootMethods 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, getId, getStepText, getUiElementName, hover, hover, hover, isDisplayed, logStep, logStepToReport, logStepToReport, scrollTo, scrollTo, scrollTo, 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.WebElementMeta
getDescription, getMetaKeys, getParent, setAssignNameMethod, setDescription, setParent, setUiElementName
-
Field Details
-
buttonNext
The button used to scroll the carousel forward. -
buttonBack
The button used to scroll the carousel backward.
-
-
Constructor Details
-
Carousel
public Carousel(org.openqa.selenium.By buttonNextLocator, org.openqa.selenium.By buttonBackLocator) Constructor to initialize the carousel with SeleniumBylocators for navigation buttons.- Parameters:
buttonNextLocator- the locator for the "Next" buttonbuttonBackLocator- the locator for the "Back" button
-
Carousel
public Carousel(org.openqa.selenium.By rootLocator, org.openqa.selenium.By buttonNextLocator, org.openqa.selenium.By buttonBackLocator) Constructor to initialize the carousel with SeleniumBylocators for the root and navigation buttons.- Parameters:
rootLocator- the locator for the carousel's root elementbuttonNextLocator- the locator for the "Next" buttonbuttonBackLocator- the locator for the "Back" button
-
Carousel
public Carousel(String selenideRootLocator, String buttonNextSelenideLocator, String buttonBackSelenideLocator) Constructor to initialize the carousel with Selenide locator strings for the root and navigation buttons.- Parameters:
selenideRootLocator- the Selenide locator string for the carousel's root elementbuttonNextSelenideLocator- the Selenide locator string for the "Next" buttonbuttonBackSelenideLocator- the Selenide locator string for the "Back" button
-
Carousel
public Carousel(com.codeborne.selenide.SelenideElement selenideRootElement, com.codeborne.selenide.SelenideElement buttonNextElement, com.codeborne.selenide.SelenideElement buttonBackLocator) Constructor to initialize the carousel withSelenideElementinstances for the root and navigation buttons.- Parameters:
selenideRootElement- theSelenideElementrepresenting the carousel's root elementbuttonNextElement- theSelenideElementrepresenting the "Next" buttonbuttonBackLocator- theSelenideElementrepresenting the "Back" button
-
-
Method Details
-
scrollForward
public void scrollForward()Scrolls the carousel forward by clicking the "Next" button.- Specified by:
scrollForwardin classAbstractCarousel
-
scrollBackward
public void scrollBackward()Scrolls the carousel backward by clicking the "Back" button.- Specified by:
scrollBackwardin classAbstractCarousel
-