blob: 7ac3806067c6d5b346057948c10edb8d1a6cd08d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
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 = findElement();
LoggerUtils.info("Entering \"" + (isSecret ? StringUtils.replaceByStars(keys) : keys) + "\" keys to the \"" + getName() + "\" field.");
field.sendKeys(keys);
}
public void clear() {
WebElement field = findElement();
LoggerUtils.info("Clearing the \"" + getName() + "\" field.");
field.clear();
}
public String getValue() {
return findElement().getAttribute("value");
}
}
|