public String getLocatorValues(By locator) {
String values;
WebElement locatorElement = wait.until(ExpectedConditions
.visibilityOfElementLocated(locator));
values = locatorElement.getText();
return values;
}
This method uses a locator parameter.
It finds an element using the locator, gets the element's text value and returns it.
In short, it returns the text of an element.
Then, it should not be called getLocatorValues but getElementText() or even shorter getText().
The locatorElement variable should be renamed as well to element:
public String getText(By locator) {
String value = "";
WebElement element = wait.until(ExpectedConditions
.visibilityOfElementLocated(locator));
value = element.getText();
return value;
}
The name of a method should explain clearly what the method does.
The name of a variable should explain clearly what the variable is.
Both names should be as short as possible.
One word is preferred.
Two words is ok.
Three words is bad.
atrocious is the correct word :)
So something like getPageElementByAttribute would be atrocious ? ;)