Class Inputs


  • public final class Inputs
    extends Object
    High-level API to define and interact with various input elements. High level API's are not optimized. A definition of an element may interact with the browser to understand the structure of the DOM.
    • Method Detail

      • inputForLabel

        public static Path inputForLabel​(String labelText)
        A lazy way to find an input based on the label. Mote that unlike It looks for a label element that has an ID. If it finds one, it returns a Path to an input with that ID. Otherwise it returns a Path to an input inside the label element.
        Parameters:
        labelText - the label to look for
        Returns:
        a Path to the input, on a best effort basis
      • inputFollowedByUnlabeledText

        public static Path inputFollowedByUnlabeledText​(String text)
        Input followed by text that does not have its on label element.
        Parameters:
        text - the text following the input
        Returns:
        a Path to the input element
      • selectInFieldWithLabel

        public static void selectInFieldWithLabel​(String labelText,
                                                  String option)
        Perform a selection of an option in a select element. It expects to find the label element with the given text before the select element
        Parameters:
        labelText - The text of the select label
        option - The option text
      • changeInputValueAssumingElementIsNotReplaced

        public static void changeInputValueAssumingElementIsNotReplaced​(Path field,
                                                                        String text)
                                                                 throws Operations.OperationFailedException
        Change input value: clear it and then enter another text in it
        Parameters:
        field - Path to the input field
        text - the text to enter in the input field
        Throws:
        Operations.OperationFailedException - failed to perform the operation
      • changeInputValueWithApproximateDeletion

        public static void changeInputValueWithApproximateDeletion​(Path field,
                                                                   String text)
                                                            throws Operations.OperationFailedException
        Change input value: clear it and then enter another text in it. Prefers speed over guaranteed clearing.
        Parameters:
        field - Path to the input field
        text - the text to enter in the input field
        Throws:
        Operations.OperationFailedException - failed to perform the operation
      • changeInputValueNonStrictClearing

        public static void changeInputValueNonStrictClearing​(Path field,
                                                             String text)
                                                      throws Operations.OperationFailedException
        Change input value: try to clear as much as it can, and then enter another text in it
        Parameters:
        field - Path to the input field
        text - the text to enter in the input field
        Throws:
        Operations.OperationFailedException - failed to perform the operation
      • changeInputValueWithEnterApproximateDeletion

        public static void changeInputValueWithEnterApproximateDeletion​(Path field,
                                                                        String text)
                                                                 throws Operations.OperationFailedException
        Similar to changeInputValueWithEnter, but deletion of previous value is approximate and prefers speed over accuracy.
        Parameters:
        field - Path to the input field
        text - the text to enter in the input field
        Throws:
        Operations.OperationFailedException - failed to perform the operation
      • genericFormInputAfterField

        public static Path genericFormInputAfterField​(String fieldName)
        A generic, reasonable guess of an input field in a form.
        Parameters:
        fieldName - - the field before the input
        Returns:
        a Path for the input field
      • genericFormInputBeforeField

        public static Path genericFormInputBeforeField​(String fieldName)
        A generic, reasonable guess of an input field in a form.
        Parameters:
        fieldName - - the field before the input
        Returns:
        a Path for the input field
      • selectDropdownOption

        public static void selectDropdownOption​(Path dropdownContent,
                                                Path myOption)