1 package vid.automation.test.infra;
3 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
4 import org.openqa.selenium.WebElement;
5 import org.openqa.selenium.support.ui.Select;
6 import vid.automation.test.Constants;
11 * Created by itzikliderman on 18/07/2017.
13 public class SelectOption {
14 public static Select byValue(String value, String dataTestsId) {
15 Select select = new Select(GeneralUIUtils.getWebElementByTestID(dataTestsId));
17 select.selectByValue(value);
23 public static Select byIdAndVisibleText(String id, String text) {
24 Select selectlist = new Select(Get.byId(id));
26 selectlist.selectByVisibleText(text);
32 public static void byClassAndVisibleText(String className, String text) {
33 final List<WebElement> webElements = Get.byClass(className);
34 webElements.forEach(webElement -> {
35 final String id = webElement.getAttribute("id");
36 byIdAndVisibleText(id, text);
39 public static List<WebElement> getList(String selectDataTestId) {
40 Select selectList = GeneralUIUtils.getSelectList(null, selectDataTestId);
41 return selectList.getOptions();
43 public static String getSelectedOption(String selectDataTestId) {
44 Select selectList = GeneralUIUtils.getSelectList(null, selectDataTestId);
45 return selectList.getFirstSelectedOption().getText();
47 public static void byTestIdAndVisibleText(String displayName, String selectDataTestId) {
48 GeneralUIUtils.getSelectList(displayName, selectDataTestId);
51 public static void selectFirstTwoOptionsFromMultiselectById(String multiSelectId) throws InterruptedException {
52 Click.byId(multiSelectId);
54 Click.byClass(Constants.MULTI_SELECT_UNSELECTED_CLASS);
55 Click.byClass(Constants.MULTI_SELECT_UNSELECTED_CLASS);
59 public static void selectOptionsFromMultiselectById(String multiSelectId, List<String> options) {
60 Click.byId(multiSelectId);
63 } catch (InterruptedException e) {
64 throw new RuntimeException(e);
66 for(String option:options) {
67 Click.byClassAndVisibleText(Constants.MULTI_SELECT_UNSELECTED_CLASS, option);