public InputBox<T> inputValue(String input) { getParentElement().setValue(input); return this; }
public ImportObjectPage stopAfterErrorsExceed(Integer count) { String c = count == null ? "" : count.toString(); $(By.name("importOptions:errors")).setValue(c); return this; }
/** * Ввод в поле текущей даты в заданном формате * При неверном формате, используется dd.MM.yyyy */ @Когда("^элемент \"([^\"]*)\" заполняется текущей датой в формате \"([^\"]*)\"$") public void currentDate(String fieldName, String dateFormat) { long date = System.currentTimeMillis(); String currentStringDate; try { currentStringDate = new SimpleDateFormat(dateFormat).format(date); } catch (IllegalArgumentException ex) { currentStringDate = new SimpleDateFormat("dd.MM.yyyy").format(date); log.error("Неверный формат даты. Будет использоваться значание по умолчанию в формате dd.MM.yyyy"); } SelenideElement valueInput = akitaScenario.getCurrentPage().getElement(fieldName); valueInput.setValue(""); valueInput.setValue(currentStringDate); akitaScenario.write("Текущая дата " + currentStringDate); }
public QuickSearch<T> inputValue(String name) { $(Schrodinger.byElementAttributeValue("input", "name", "searchInput")).setValue(name); return this; }
/** * Добавление строки (в приоритете: из property, из переменной сценария, значение аргумента) в поле к уже заполненой строке */ @Когда("^в элемент \"([^\"]*)\" дописывается значение \"(.*)\"$") public void addValue(String elementName, String value) { value = getPropertyOrStringVariableOrValue(value); SelenideElement field = akitaScenario.getCurrentPage().getElement(elementName); String oldValue = field.getValue(); if (oldValue.isEmpty()) { oldValue = field.getText(); } field.setValue(""); field.setValue(oldValue + value); }
public InputTable<T> addAttributeValue(String attributeName, String attributeValue){ SelenideElement element = $(Schrodinger.byAncestorPrecedingSiblingDescendantOrSelfElementEnclosedValue("input","type","text",null,null,attributeName)) .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).setValue(attributeValue); return this; }
public PrismForm<T> addProtectedAttributeValue(String protectedAttributeName, String value) { SelenideElement property = findProperty(protectedAttributeName); ElementsCollection values = property.$$(By.xpath(".//input[contains(@class,\"form-control\")]")); for (SelenideElement valueElemen : values) { valueElemen.setValue(value).waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S); } return this; }
public Popover<T> inputValue(String input) { getParentElement().$(Schrodinger.byDataId("textInput")).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).setValue(input); return this; }
/** * Ввод в поле случайной последовательности цифр задаваемой длины */ @Когда("^в поле \"([^\"]*)\" введено случайное число из (\\d+) (?:цифр|цифры)$") public void inputRandomNumSequence(String elementName, int seqLength) { SelenideElement valueInput = akitaScenario.getCurrentPage().getElement(elementName); cleanField(elementName); String numSeq = RandomStringUtils.randomNumeric(seqLength); valueInput.setValue(numSeq); akitaScenario.write(String.format("В поле [%s] введено значение [%s]", elementName, numSeq)); }
/** * Ввод в поле случайной последовательности латинских или кириллических букв задаваемой длины */ @Когда("^в поле \"([^\"]*)\" введено (\\d+) случайных символов на (кириллице|латинице)$") public void setRandomCharSequence(String elementName, int seqLength, String lang) { SelenideElement valueInput = akitaScenario.getCurrentPage().getElement(elementName); cleanField(elementName); if (lang.equals("кириллице")) lang = "ru"; else lang = "en"; String charSeq = getRandCharSequence(seqLength, lang); valueInput.setValue(charSeq); akitaScenario.write("Строка случайных символов равна :" + charSeq); }
/** * Устанавливается значение (в приоритете: из property, из переменной сценария, значение аргумента) в заданное поле. * Перед использованием поле нужно очистить */ @Когда("^в поле \"([^\"]*)\" введено значение \"(.*)\"$") public void setFieldValue(String elementName, String value) { value = getPropertyOrStringVariableOrValue(value); SelenideElement valueInput = akitaScenario.getCurrentPage().getElement(elementName); cleanField(elementName); valueInput.setValue(value); }
/** * Ввод в поле случайной последовательности латинских или кириллических букв задаваемой длины и сохранение этого значения в переменную */ @Когда("^в поле \"([^\"]*)\" введено (\\d+) случайных символов на (кириллице|латинице) и сохранено в переменную \"([^\"]*)\"$") public void setRandomCharSequenceAndSaveToVar(String elementName, int seqLength, String lang, String varName) { SelenideElement valueInput = akitaScenario.getCurrentPage().getElement(elementName); cleanField(elementName); if (lang.equals("кириллице")) lang = "ru"; else lang = "en"; String charSeq = getRandCharSequence(seqLength, lang); valueInput.setValue(charSeq); akitaScenario.setVar(varName, charSeq); akitaScenario.write("Строка случайных символов равна :" + charSeq); }
/** * Ввод в поле случайной последовательности цифр задаваемой длины и сохранение этого значения в переменную */ @Когда("^в поле \"([^\"]*)\" введено случайное число из (\\d+) (?:цифр|цифры) и сохранено в переменную \"([^\"]*)\"$") public void inputAndSetRandomNumSequence(String elementName, int seqLength, String varName) { SelenideElement valueInput = akitaScenario.getCurrentPage().getElement(elementName); cleanField(elementName); String numSeq = RandomStringUtils.randomNumeric(seqLength); valueInput.setValue(numSeq); akitaScenario.setVar(varName, numSeq); akitaScenario.write(String.format("В поле [%s] введено значение [%s] и сохранено в переменную [%s]", elementName, numSeq, varName)); }
public BasicPage login(String username, String password) { open("/login"); Selenide.sleep(5000); $(By.name("username")).waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S).setValue(username); $(By.name("password")).waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S).setValue(password); $x("//input[@type='submit']").click(); return new BasicPage(); } }
public PrismForm<T> addAttributeValue(QName name, String value) { SelenideElement property = findProperty(name); ElementsCollection values = property.$$(By.className("prism-property-value")); if (values.size() == 1) { values.first().$(By.className("form-control")).setValue(value); } // todo implement return this; }
public PrismForm<T> setPasswordFieldsValues(QName name, String value) { SelenideElement property = findProperty(name); ElementsCollection values = property.$$(By.className("prism-property-value")); if (values.size() > 0) { ElementsCollection passwordInputs = values.first().$$(By.tagName("input")); if (passwordInputs != null){ passwordInputs.forEach(inputElement -> inputElement.setValue(value)); } } return this; }
public PrismForm<T> changeAttributeValue(String name, String oldValue, String newValue) { SelenideElement property = findProperty(name); $(By.className("prism-properties")).waitUntil(Condition.appears,MidPoint.TIMEOUT_MEDIUM_6_S); ElementsCollection values = property.$$(By.className("prism-property-value")); if (values.size() == 1) { values.first().$(By.className("form-control")).setValue(newValue); } // todo implement return this; }
public PrismForm<T> addAttributeValue(String name, String value) { SelenideElement property = findProperty(name); $(By.className("prism-properties")).waitUntil(Condition.appears,MidPoint.TIMEOUT_MEDIUM_6_S); ElementsCollection values = property.$$(By.className("prism-property-value")); if (values.size() == 1) { values.first().$(By.className("form-control")).setValue(value); } // todo implement return this; }
public Paging<T> pageSize(int size) { Validate.isTrue(size > 0, "Size must be larger than zero."); SelenideElement parent = getParentElement(); SelenideElement button = parent.$(By.cssSelector(".btn.btn-default.dropdown-toggle")); button.click(); button.parent().$(By.className("dropdown-menu")).$$x(".//a").first().click(); SelenideElement popover = parent.$$(By.className("popover-title")) .findBy(Condition.text("Page size")).parent(); //todo fix localization popover.$(By.tagName("input")).setValue(Integer.toString(size)); popover.$(By.tagName("button")).click(); return this; }