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

How to use
SelenideElement
in
com.codeborne.selenide

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

origin: Evolveum/midpoint

  public EditTaskPage clickResume() {

    $(Schrodinger.byDataResourceKey("a", "pageTaskEdit.button.resume")).waitUntil(Condition.visible, MidPoint.TIMEOUT_DEFAULT_2_S).click();

    return this;
  }
}
origin: Evolveum/midpoint

  public void clickOnWizardTab(String tabName){
    $(By.linkText(tabName))
        .shouldBe(Condition.visible)
        .click();
  }
}
origin: alfa-laboratory/akita

/**
 * Получение текста элемента, как редактируемого поля, так и статичного элемента по значению элемента
 */
public String getAnyElementText(SelenideElement element) {
  if (element.getTagName().equals("input")) {
    return element.getValue();
  } else {
    return element.getText();
  }
}
origin: Evolveum/midpoint

  private SelenideElement verifyAndFetchActiveTab(SelenideElement link) {
    link.shouldBe(Condition.visible);

    link.click();

    SelenideElement li = link.parent();
    li.shouldHave(Condition.cssClass("active"));

    return li.parent().parent().$(By.cssSelector(".tab-pane.active"));
  }
}
origin: Evolveum/midpoint

public String getTabBadgeText(String resourceKey) {
  SelenideElement element = getParentElement().$(Schrodinger.bySchrodingerDataResourceKey(resourceKey));
  element.shouldBe(Condition.visible);
  SelenideElement badge = element.$(Schrodinger.byDataId("small", "count"));
  badge.shouldBe(Condition.visible);
  return badge.getValue();
}
origin: Evolveum/midpoint

  private void clickMenuItem(String topLevelMenuKey, String mainMenuKey, String menuItemKey) {
    SelenideElement topLevelMenu = $(Schrodinger.byDataResourceKey(topLevelMenuKey));
    topLevelMenu.shouldBe(Condition.visible);

    SelenideElement topLevelMenuChevron = topLevelMenu.parent().$(By.tagName("i"));
    if (!topLevelMenuChevron.has(Condition.cssClass("fa-chevron-down"))) {
      topLevelMenu.click();
      topLevelMenuChevron.shouldHave(Condition.cssClass("fa-chevron-down")).waitUntil(Condition.cssClass("fa-chevron-down"), MidPoint.TIMEOUT_DEFAULT_2_S);
    }

    SelenideElement mainMenu = topLevelMenu.$(Schrodinger.byDataResourceKey(mainMenuKey));
    mainMenu.shouldBe(Condition.visible);
    if (menuItemKey == null) {
      mainMenu.click();
      return;
    }

    SelenideElement mainMenuLi = mainMenu.parent().parent();
    if (!mainMenuLi.has(Condition.cssClass("active"))) {
      mainMenu.click();
      mainMenuLi.waitUntil(Condition.cssClass("active"),MidPoint.TIMEOUT_DEFAULT_2_S).shouldHave(Condition.cssClass("active"));
    }

    SelenideElement menuItem = mainMenu.$(Schrodinger.byDataResourceKey(menuItemKey));
    menuItem.shouldBe(Condition.visible);

    menuItem.click();
  }
}
origin: Evolveum/midpoint

public T clickImport() {
  $(Schrodinger.byDataResourceKey("pageContentAccounts.menu.importAccounts"))
      .parent().waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click();
  return this.getParent();
}
origin: Evolveum/midpoint

  public InputBox<Search<T>> byFullText() {

    SelenideElement linksContainer = getParentElement().$(Schrodinger.byDataId("div", "linksContainer")).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S);
    try {
      linksContainer.$(Schrodinger.byDataId("a", "fullText")).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S).click();
    } catch (Throwable t) {
      // all is ok, fullText search is already selected option, TODO: Schrodinger should provide easy method to check component existence
    }

    // we assume fulltext is enabled in systemconfig, else error is thrown here:
    SelenideElement fullTextField = getParentElement().$(Schrodinger.byDataId("input", "fullTextField")).waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S);
    return new InputBox<> (this, fullTextField);
  }
}
origin: Evolveum/midpoint

public FocusSetAssignmentsModal<T> selectType(String option) {
  SelenideElement tabElement = $(Schrodinger.byElementValue("a", "class", "tab-label", option))
      .waitUntil(Condition.appears, MidPoint.TIMEOUT_DEFAULT_2_S);
  String classActive = tabElement.attr("class");
  tabElement.click();
  if (!classActive.contains("active")) {
    $(Schrodinger.byElementValue("a", "class", "tab-label", option))
        .waitUntil(Condition.attribute("class", classActive + " active"), MidPoint.TIMEOUT_DEFAULT_2_S).exists();
  }
  return this;
}
origin: selenide-examples/hangman

@Test
public void userHasNoMoreThan6Tries() {
 letter("B").click();
 letter("D").click();
 letter("E").click();
 letter("G").click();
 letter("H").click();
 letter("I").click();
 letter("J").click();
 letter("B").shouldHave(cssClass("nonused"));
 $("#gameLost").shouldBe(visible);
}
origin: selenide-examples/hangman

@Test
public void userCanGuessLetters() {
 letter("S").click();
 $("#wordInWork").shouldHave(text("s___"));
 letter("S").shouldHave(cssClass("used"));
}
origin: alfa-laboratory/akita

/**
 * Выбор из списка со страницы элемента, который содержит заданный текст
 * (в приоритете: из property, из переменной сценария, значение аргумента)
 * Не чувствителен к регистру
 */
@Когда("^в списке \"([^\"]*)\" выбран элемент содержащий текст \"([^\"]*)\"$")
public void selectElementInListIfFoundByText(String listName, String expectedValue) {
  final String value = getPropertyOrStringVariableOrValue(expectedValue);
  List<SelenideElement> listOfElementsFromPage = akitaScenario.getCurrentPage().getElementsList(listName);
  List<String> elementsListText = listOfElementsFromPage.stream()
      .map(element -> element.getText().trim().toLowerCase())
      .collect(toList());
  listOfElementsFromPage.stream()
      .filter(element -> element.getText().trim().toLowerCase().contains(value.toLowerCase()))
      .findFirst()
      .orElseThrow(() -> new IllegalArgumentException(String.format("Элемент [%s] не найден в списке %s: [%s] ", value, listName, elementsListText)))
      .click();
}
origin: selenide/selenide

 @Override
 public SelenideElement execute(SelenideElement proxy, WebElementSource locator, Object[] args) {
  SelenideElement target;
  if (args[0] instanceof String) {
   target = ElementFinder.wrap(locator.driver(), By.cssSelector((String) args[0]));
  }
  else if (args[0] instanceof WebElement) {
   target = WebElementWrapper.wrap(locator.driver(), (WebElement) args[0]);
  }
  else {
   throw new IllegalArgumentException("Unknown target type: " + args[0] +
    " (only String or WebElement are supported)");
  }
  target.shouldBe(visible);
  new Actions(locator.driver().getWebDriver()).dragAndDrop(locator.getWebElement(), target).perform();
  return proxy;
 }
}
origin: selenide-examples/google

 @Test
 public void search_selenide_in_google() {
  open("https://google.com/ncr");
  $(By.name("q")).val("selenide").pressEnter();
  $$("#ires .g").shouldHave(sizeGreaterThan(1));
  $("#ires .g").shouldBe(visible).shouldHave(
    text("Selenide: concise UI tests in Java"),
    text("selenide.org"));
 }
}
origin: alfa-laboratory/akita

/**
 * На странице происходит клик по заданному элементу
 */
@И("^выполнено нажатие на (?:кнопку|поле|блок) \"([^\"]*)\"$")
public void clickOnElement(String elementName) {
  akitaScenario.getCurrentPage().getElement(elementName).click();
}
origin: Evolveum/midpoint

public Boolean isSuccess() {
  return getParentElement().$(By.cssSelector("div.feedback-message.box.box-solid.box-success")).waitUntil(Condition.appears, MidPoint.TIMEOUT_LONG_1_M).exists();
}
origin: org.apache.jspwiki.it/jspwiki-selenide-tests

public ReadWikiPage performLogin( String login, String password ) {
  Selenide.$( By.id( "j_username" ) ).val( login );
  Selenide.$( By.id( "j_password" ) ).val( password );
  Selenide.$( By.name( "submitlogin" ) ).click();
  
  return new ReadWikiPage();
}
origin: com.epam.jdi/jdi-uitest-web

public JList shouldHave(Condition... conditions) {
  Selenide.$(getWebElement()).shouldHave(conditions);
  return this;
}
origin: Evolveum/midpoint

public T clickShowExisting() {
  $(Schrodinger.byDataResourceKey("schrodinger", "ResourceContentResourcePanel.showExisting")).parent()
      .click();
  return this.getParent();
}
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);
}
com.codeborne.selenideSelenideElement

Javadoc

Wrapper around WebElement with additional methods like #shouldBe(Condition...) and #shouldHave(Condition...)

Most used methods

  • click
    Click the element with a relative offset from the upper left corner of the element
  • 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,
  • setValue,
  • should,
  • text,
  • uploadFile,
  • val,
  • waitWhile

Popular in Java

  • Parsing JSON documents to java classes using gson
  • compareTo (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getApplicationContext (Context)
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top PhpStorm 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