Class InputBy

    • Method Detail

      • label

        public static org.openqa.selenium.By label​(String labelText)

        Will return a list of By objects, which are

        • a. Of type input
        • b. Contains the label sent as parameter
        • c. Has a general structure of <label><input /> </label>
        For example:
        The following html code:
         
         <html>
         	<body>
         		<label>This is a label 
         			<input id="text">
         		</label>
        	</body>
         </html>
          
        can be located using any of the words 'This is a label':
        driver.findElements(InputBy.label("label"));
        If the structure of the form does not comply with <label> <input /> </label> then the search will not find the input
        Parameters:
        labelText - the name of the label to look for
        Returns:
        By object to be searched for in findElements