winium.elements.desktop.extensions.ByExtensions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of winium-elements-desktop Show documentation
Show all versions of winium-elements-desktop Show documentation
With the help of Winium.Elements you could simplify interaction
with such complex elements like DataGrid, ComboBox, Menu and etc.
The newest version!
package winium.elements.desktop.extensions;
import org.openqa.selenium.By;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ByExtensions {
private ByExtensions() { }
private static Pattern descriptionRegexp = Pattern.compile("\\.(.*): (.*)");
public static Object getStrategy(By by) {
Matcher m = descriptionRegexp.matcher(by.toString());
if (!m.find())
return null;
return m.group(1).replaceAll("([A-Z])", " $1").split("\\[")[0].trim().toLowerCase();
}
public static Object getValue(By by) {
Matcher m = descriptionRegexp.matcher(by.toString());
if (!m.find())
return null;
return m.group(2);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy