I reworked my java project to define WebElement selectors as constants. This allows me to pass the By constant into my findElement method without requiring an evaluation of type By selector in the method. Is that a good idea? What problems can I encounter if I define By variables as public static finite constants?
The following is an example:
public static final By LOGIN_BUTTON_SELECTOR = By .cssSelector("input[name='logIn']"); public void clickLoginButton() throws TimeoutException, StaleElementReferenceException {
Lori johnson
source share