aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/vid/automation/test/infra/Exists.java
blob: 14339d63f895aeebfd76b63b2fba3afe19af250b (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
package vid.automation.test.infra;

import org.openqa.selenium.NoSuchElementException;
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;
        }
    }
}