Package allurium.inputs
Class CheckBox
java.lang.Object
allurium.primitives.UIElement
allurium.inputs.AbstractInputElement
allurium.inputs.CheckBox
- All Implemented Interfaces:
AlluriumElement,InputElement,ListComponent,WebElementMeta
Represents a checkbox element in the UI, extending
UIElement.
This class provides methods to interact with and validate the state of checkboxes. It supports toggling the checkbox on/off and asserting its state. A proxy element can also be used for cases where the checkbox itself is not directly interactable.
Features:
- Check and uncheck functionality.
- State verification (checked/unchecked).
- Proxy element support for inaccessible checkboxes.
Purpose:
- Encapsulates behavior specific to checkbox elements.
- Simplifies interactions and state validations for checkboxes.
-
Field Summary
Fields inherited from class allurium.primitives.UIElement
assignNameMethod, description, id, parent, root, stepsConsoleLoggingEnabled, stepsReportLoggingEnabled, uiElementName, uiElementType -
Constructor Summary
ConstructorsConstructorDescriptionCheckBox()Default constructor.CheckBox(com.codeborne.selenide.SelenideElement selenideElement) Constructor that initializes a checkbox using a Selenide element.Constructor that initializes a checkbox using a Selenide element and a name.Constructor that initializes a checkbox using a Selenide locator string.Constructor that initializes a checkbox using a Selenide locator string and a name.CheckBox(org.openqa.selenium.By locator) Constructor that initializes a checkbox using a SeleniumBylocator.Constructor that initializes a checkbox using a SeleniumBylocator and a name.CheckBox(org.openqa.selenium.By checkBoxLocator, org.openqa.selenium.By proxyElementLocator) Constructor that initializes a checkbox using a main locator and a proxy locator. -
Method Summary
Modifier and TypeMethodDescriptionstatic CheckBox_$checkbox(String xpath) static CheckBox$checkbox(com.codeborne.selenide.SelenideElement selenideElement) static CheckBoxstatic CheckBoxstatic CheckBox$checkbox(org.openqa.selenium.By locator) static CheckBoxvoidAsserts that the checkbox is currently checked.voidAsserts that the checkbox is currently unchecked.voidcheck()Toggles the checkbox to the checked state.booleanChecks if the checkbox is currently selected.voidset(boolean state) Sets the checkbox to the specified state.voiduncheck()Toggles the checkbox to the unchecked state.Methods inherited from class allurium.inputs.AbstractInputElement
assertDisabled, assertEnabled, isDisabledMethods 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
-
CheckBox
public CheckBox()Default constructor. Initializes the element type as "checkbox". -
CheckBox
public CheckBox(com.codeborne.selenide.SelenideElement selenideElement) Constructor that initializes a checkbox using a Selenide element.- Parameters:
selenideElement- the Selenide element representing the checkbox
-
CheckBox
Constructor that initializes a checkbox using a Selenide locator string.- Parameters:
selenideLocator- the Selenide locator as a string
-
CheckBox
Constructor that initializes a checkbox using a Selenide locator string and a name.- Parameters:
selenideLocator- the Selenide locator as a stringname- the name of the checkbox
-
CheckBox
public CheckBox(org.openqa.selenium.By locator) Constructor that initializes a checkbox using a SeleniumBylocator.- Parameters:
locator- the Selenium locator for the checkbox
-
CheckBox
Constructor that initializes a checkbox using a SeleniumBylocator and a name.- Parameters:
locator- the Selenium locator for the checkboxname- the name of the checkbox
-
CheckBox
Constructor that initializes a checkbox using a Selenide element and a name.- Parameters:
selenideElement- the Selenide element representing the checkboxname- the name of the checkbox
-
CheckBox
public CheckBox(org.openqa.selenium.By checkBoxLocator, org.openqa.selenium.By proxyElementLocator) Constructor that initializes a checkbox using a main locator and a proxy locator.- Parameters:
checkBoxLocator- the main locator for the checkboxproxyElementLocator- the locator for the proxy element
-
-
Method Details
-
$checkbox
-
$checkbox
-
$checkbox
-
$checkbox
-
$checkbox
-
_$checkbox
-
isChecked
public boolean isChecked()Checks if the checkbox is currently selected.- Returns:
trueif the checkbox is selected,falseotherwise
-
check
public void check()Toggles the checkbox to the checked state.Step: Processed by Aspect
-
uncheck
public void uncheck()Toggles the checkbox to the unchecked state.Step: Processed by Aspect
-
set
public void set(boolean state) Sets the checkbox to the specified state.- Parameters:
state-trueto check the checkbox,falseto uncheck it
-
assertChecked
public void assertChecked()Asserts that the checkbox is currently checked.Step: Processed by Aspect
-
assertUnchecked
public void assertUnchecked()Asserts that the checkbox is currently unchecked.Step: Processed by Aspect
-