Package net.serenitybdd.screenplay.ui
Class Button
java.lang.Object
net.serenitybdd.screenplay.ui.Button
An HTML element representing a button.
This element will match an HTML button element containing the specified text, or a button-styled input field with a matching value, id or data-test attribute.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SearchableTargetcontainingText(String text) Locate an element that contains a specified text value in its body.static SearchableTargetlocated(org.openqa.selenium.By selector) static SearchableTargetLocate a button using an arbitrary CSS or XPath expressionstatic SearchableTargetwithAriaLabel(String name) Locate a button using the ARIA label valuestatic SearchableTargetwithCSSClass(String className) Look for an element with a given CSS classstatic SearchableTargetA button containing an iconstatic SearchableTargetLocate a button using an HTML Label valuestatic SearchableTargetwithLocalisedLabelFor(String name) Locate a button using an internationalised element.static SearchableTargetwithNameOrId(String nameOrId) Locate a button element with a given id, name or aria-label.static SearchableTargetLocate a button element with a given text.
-
Constructor Details
-
Button
public Button()
-
-
Method Details
-
withText
Locate a button element with a given text. -
withNameOrId
Locate a button element with a given id, name or aria-label. -
withLocalisedLabelFor
Locate a button using an internationalised element. Internationalised elements are defined in the serenity.conf file in the i8n section, e.g.locale = fr i8n { "Search" { en: "Search" fr: "Recherche" } "Sign Up" { en: "Sign Up" fr: "Se connecter" } }
-
withLabel
Locate a button using an HTML Label value -
withAriaLabel
Locate a button using the ARIA label value -
withIcon
A button containing an icon -
withCSSClass
Look for an element with a given CSS class -
containingText
Locate an element that contains a specified text value in its body. This will not include text that is contained in nested elements. -
locatedBy
Locate a button using an arbitrary CSS or XPath expression -
located
-