package com.mavlushechka.a1qa.elements; import com.mavlushechka.a1qa.utils.LoggerUtils; import com.mavlushechka.a1qa.utils.StringUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; public class Field extends BaseElement { public Field(By locator, String name) { super(locator, name); } public void sendKeys(String keys) { sendKeys(keys, false); } public void sendKeys(String keys, boolean isSecret) { WebElement field = find(); LoggerUtils.info("Entering \"" + (isSecret ? StringUtils.replaceByStars(keys) : keys) + "\" keys to the \"" + getName() + "\" field."); field.sendKeys(keys); } public void clear() { WebElement field = find(); LoggerUtils.info("Clearing the \"" + getName() + "\" field."); field.clear(); } public String getValue() { return find().getAttribute("value"); } }