ElementActions
Static methodsâ
onElement
â
This will return IElementActions
which will expose different methods to handle all other element actions.
IElementActions elementActions = ElementActions.onElement ();
Instance methodsâ
getAttribute (attribute)
â
This method is used to get the attribute of the given element.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
String attribute = onElement (locator).getAttribute ("href");
clear
â
This method is used to clear the given element.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
onElement (locator).clear ();
isDisplayed
â
This method is used to check whether the given element is displayed or not.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
boolean displayed = onElement (locator).isDisplayed ();
isEnabled
â
This method is used to check whether the given element is enabled or not.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
boolean enabled = onElement (locator).isEnabled ();
isSelected
â
This method is used to check whether the given element is selected or not.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
boolean selected = onElement (locator).isSelected ();
scrollIntoView
â
This method will scroll the element into the viewport.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
onElement (locator).scrollIntoView ();
getStyle (attribute)
â
This method will return the style of the given element for the given attribute.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
String backgroundColor = onElement (locator).getStyle ("background-color");
tap
â
This method will tap on element on the Mobile screen using W3C actions.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
onElement (locator).tap ();
getText
â
This method is used to get the text of the given element.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
String text = onElement (locator).getText ();
verifyAttribute (attribute)
â
This method is used to verify the given attribute of the given element.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
onElement (locator).verifyAttribute ("attribute-name").isEqualTo ("Swag Labs");
verifyIsDisplayed
â
This method is used to verify the given element is displayed.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
onElement (locator).verifyIsDisplayed ().isTrue();
verifyIsEnabled
â
This method is used to verify the given element is enabled.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
onElement (locator).verifyIsEnabled ().isTrue();
verifyIsSelected
â
This method is used to verify the given element is selected.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
onElement (locator).verifyIsSelected ().isTrue();
verifyStyle (attribute)
â
This method is used to verify the style of the given element locator.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
onElement (locator).verifyStyleOf ("color").isEqualTo ("Red");
verifyText
â
This method is used to verify the text of the given element.
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
. . .
onElement (locator).verifyText ().isEqualTo ("Swag Labs");