blob: f2cbbef8008da2df2ba90c8a88a5fc0297efc9bb (
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
45
46
47
48
49
50
51
52
53
54
|
package vid.automation.test.infra;
import org.junit.Assert;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import java.util.List;
public class Click {
public static void byText(String text) {
WebElement element = GeneralUIUtils.findByText(text);
Assert.assertTrue(element != null);
element.click();
}
public static void byId(String id) {
WebElement element = Get.byId(id);
Assert.assertTrue(element != null);
element.click();
}
public static void byTestId(String testId) {
WebElement element = Get.byTestId(testId);
Assert.assertTrue(element != null);
element.click();
}
public static void byClass(String className) {
List<WebElement> elements = Get.byClass(className);
Assert.assertTrue(elements != null && elements.size() > 0);
elements.get(0).click();
}
public static void onFirstSelectOptionById(String id) {
Select selectlist = new Select(Get.byId(id));
if(selectlist.getOptions().size() > 1) {
selectlist.selectByIndex(1);
}
}
public static void onFirstSelectOptionByClass(String className) {
final List<WebElement> webElements = Get.byClass(className);
webElements.forEach(webElement -> {
Select selectlist = new Select(webElement);
if (selectlist.getOptions().size() > 1) {
selectlist.selectByIndex(1);
}
});
}
}
|