blob: 63327f50c34d2fca1507444640be30779e011061 (
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
37
38
39
40
41
42
43
44
|
package vid.automation.test.infra;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import vid.automation.test.Constants;
public class Exists {
public static boolean byId(String id) {
return Get.byId(id) != null;
}
public static boolean byTestId(String testId) {
return Get.byTestId(testId) != null;
}
public static boolean byClass(String className) {
return Get.byClass(className) != null;
}
public static boolean byClassAndText(String className, String text) {
return Get.byClassAndText(className, text) != null;
}
public static boolean byCssSelectorAndText(String css, String text) {
return Get.byCssSelectorAndText(css, text) != null;
}
public static boolean modal() {
try {
return Get.byCssSelector(Constants.Modals.modalClass) != null;
} catch (NoSuchElementException exception) {
return false;
}
}
public static boolean tagNameInAnotherElement(WebElement parent, String tagName) {
try {
return parent.findElement(By.tagName(tagName)) != null;
} catch (NoSuchElementException exception) {
return false;
}
}
}
|