All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.verisoft.fw.utils.locators.InputBy Maven / Gradle / Ivy

There is a newer version: 2.3.1
Show newest version
package co.verisoft.fw.utils.locators;

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import org.openqa.selenium.By;

/**
 * 

* Find elements which are of type input.
* This mechanism used to locate elements within a form. *

* * * @author Nir Gallner * @since 0.1 * * @see org.openqa.selenium.support.pagefactory.ByAll * @see AllBy * @see ElementBy * @see AnyBy * @see NotBy * @see TdBy */ public final class InputBy { private InputBy() { } /** *

* Will return a list of {@link By By} objects, which are *

    *
  • a. Of type input
  • *
  • b. Contains the label sent as parameter
  • *
  • c. Has a general structure of {@code }
  • *
* For example:
* The following html code: *
	 * {@code
	 * 
	 * 	
	 * 		
	 *	
	 * 
	 * } 
* can be located using any of the words 'This is a label':
* {@code driver.findElements(InputBy.label("label"));}
* If the structure of the form does not comply with {@code } then the * search will not find the input * * @param labelText the name of the label to look for * @return By object to be searched for in findElements */ public static By label(String labelText) { return By.xpath("//label[contains(.,'" + labelText + "')]/input"); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy