
co.verisoft.fw.utils.locators.ElementBy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Selenium4-Junit5 Show documentation
Show all versions of Selenium4-Junit5 Show documentation
VeriSoft framework for testing web and mobile applications. Selenium Module
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;
/**
*
* A set of static methods to extend the search mechanism.
* It is used to simplify commonly used {@link org.openqa.selenium FindBy}.
* For example:
* {@code WebElement myElement = driver.findElement(ElementBy.partialText("searchText"));}
*
*
* @author Nir Gallner
* @since 0.1
*
* @see org.openqa.selenium.support.pagefactory.ByAll
* @see AllBy
* @see AnyBy
* @see InputBy
* @see NotBy
* @see TdBy
*/
public final class ElementBy {
private ElementBy() {
}
/**
* Finds an element by using any part of it's tag value.
* For example - {@code value } can be discovered by "value" or "val" using the following code:
* {@code List myList = driver.findElements(ElementBy.partialText("val"));}
* @param text the string to be searched
* @return a By object with the string to be searched, ready to be sent to findElement or
* findElements
*/
public static By partialText(String text) {
return By.xpath("//*[contains(normalize-space(.),'" + text + "')]");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy