Tabnine Logo
SelenideElement.setValue
Code IndexAdd Tabnine to your IDE (free)

How to use
setValue
method
in
com.codeborne.selenide.SelenideElement

Best Java code snippets using com.codeborne.selenide.SelenideElement.setValue (Showing top 19 results out of 315)

origin: Evolveum/midpoint

public InputBox<T> inputValue(String input) {
  getParentElement().setValue(input);
  return this;
}
origin: Evolveum/midpoint

public ImportObjectPage stopAfterErrorsExceed(Integer count) {
  String c = count == null ? "" : count.toString();
  $(By.name("importOptions:errors")).setValue(c);
  return this;
}
origin: alfa-laboratory/akita

/**
 * Ввод в поле текущей даты в заданном формате
 * При неверном формате, используется 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);
}
origin: Evolveum/midpoint

public QuickSearch<T> inputValue(String name) {
  $(Schrodinger.byElementAttributeValue("input", "name", "searchInput")).setValue(name);
  return this;
}
origin: alfa-laboratory/akita

/**
 * Добавление строки (в приоритете: из 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);
}
origin: Evolveum/midpoint

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;
}
origin: Evolveum/midpoint

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;
}
origin: Evolveum/midpoint

public Popover<T> inputValue(String input) {
  getParentElement().$(Schrodinger.byDataId("textInput")).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).setValue(input);
  return this;
}
origin: alfa-laboratory/akita

/**
 * Ввод в поле случайной последовательности цифр задаваемой длины
 */
@Когда("^в поле \"([^\"]*)\" введено случайное число из (\\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));
}
origin: alfa-laboratory/akita

/**
 * Ввод в поле случайной последовательности латинских или кириллических букв задаваемой длины
 */
@Когда("^в поле \"([^\"]*)\" введено (\\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);
}
origin: alfa-laboratory/akita

/**
 * Устанавливается значение (в приоритете: из property, из переменной сценария, значение аргумента) в заданное поле.
 * Перед использованием поле нужно очистить
 */
@Когда("^в поле \"([^\"]*)\" введено значение \"(.*)\"$")
public void setFieldValue(String elementName, String value) {
  value = getPropertyOrStringVariableOrValue(value);
  SelenideElement valueInput = akitaScenario.getCurrentPage().getElement(elementName);
  cleanField(elementName);
  valueInput.setValue(value);
}
origin: alfa-laboratory/akita

/**
 * Ввод в поле случайной последовательности латинских или кириллических букв задаваемой длины и сохранение этого значения в переменную
 */
@Когда("^в поле \"([^\"]*)\" введено (\\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);
}
origin: alfa-laboratory/akita

/**
 * Ввод в поле случайной последовательности цифр задаваемой длины и сохранение этого значения в переменную
 */
@Когда("^в поле \"([^\"]*)\" введено случайное число из (\\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));
}
origin: Evolveum/midpoint

  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();
  }
}
origin: Evolveum/midpoint

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;
}
origin: Evolveum/midpoint

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;
}
origin: Evolveum/midpoint

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;
}
origin: Evolveum/midpoint

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;
}
origin: Evolveum/midpoint

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;
}
com.codeborne.selenideSelenideElementsetValue

Javadoc

Implementation details:

If Configuration.versatileSetValue is true, can work as 'selectOptionByValue', 'selectRadio'

If Configuration.fastSetValue is true, sets value by javascript instead of using Selenium built-in "sendKey" function and trigger "focus", "keydown", "keypress", "input", "keyup", "change" events.

In other case behavior will be:

 
1. WebElement.clear() 
2. WebElement.sendKeys(text) 
3. Trigger change event 

Popular methods of SelenideElement

  • click
  • shouldBe
  • getText
    Get the visible text of this element, including sub-elements without leading/trailing whitespace. NB
  • is
  • shouldHave
  • waitUntil
  • attr
    Get the attribute of the element. Synonym for getAttribute(String).
  • exists
    Checks if element exists true on the current page.
  • getValue
    Get the "value" attribute of the element
  • has
  • hover
  • isDisplayed
    Check if this element exists and visible.
  • hover,
  • isDisplayed,
  • isEnabled,
  • pressEnter,
  • should,
  • text,
  • uploadFile,
  • val,
  • waitWhile

Popular in Java

  • Making http post requests using okhttp
  • getContentResolver (Context)
  • setContentView (Activity)
  • setRequestProperty (URLConnection)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now