Java Code Examples for com.codeborne.selenide.SelenideElement#exists()
The following examples show how to use
com.codeborne.selenide.SelenideElement#exists() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: N2oInputMoney.java From n2o-framework with Apache License 2.0 | 5 votes |
@Override public void shouldHaveValue(String value) { SelenideElement elm = inputElement(); if (elm.exists()) elm.shouldHave(value == null || value.isEmpty() ? Condition.empty : Condition.value(value)); else element().$(".n2o-editable-cell .n2o-editable-cell-text").shouldHave(value == null || value.isEmpty() ? Condition.empty : Condition.text(value)); }
Example 2
Source File: WebPageInteractionSteps.java From akita with Apache License 2.0 | 5 votes |
/** * Скроллит страницу вниз до появления элемента с текстом из property файла, из переменной сценария или указанному в шаге каждую секунду. * Если достигнут футер страницы и элемент не найден - выбрасывается exception. */ @И("^страница прокручена до появления элемента с текстом \"([^\"]*)\"$") @When("^page has been scrolled down till the element with text \"([^\"]*)\" is appeared$") public void scrollWhileElemWithTextNotFoundOnPage(String expectedValue) { SelenideElement el = null; do { el = $(By.xpath(getTranslateNormalizeSpaceText(getPropertyOrStringVariableOrValue(expectedValue)))); if (el.exists()) { break; } executeJavaScript("return window.scrollBy(0, 250);"); sleep(1000); } while (!atBottom()); assertThat("Элемент с текстом " + expectedValue + " не найден", el.isDisplayed()); }
Example 3
Source File: N2oPasswordControl.java From n2o-framework with Apache License 2.0 | 5 votes |
@Override public void shouldHaveValue(String value) { SelenideElement elm = inputElement(); if (elm.exists()) elm.shouldHave(value == null || value.isEmpty() ? Condition.empty : Condition.value(value)); else element().$(".n2o-editable-cell .n2o-editable-cell-text").shouldHave(value == null || value.isEmpty() ? Condition.empty : Condition.text(value)); }
Example 4
Source File: N2oInputText.java From n2o-framework with Apache License 2.0 | 5 votes |
@Override public void shouldHavePlaceholder(String placeholder) { Condition condition = Condition.attribute("placeholder", placeholder); SelenideElement elm = inputElement(); if (elm.exists()) elm.shouldHave(condition); else cellInputElement().shouldHave(condition); }
Example 5
Source File: N2oInputMoney.java From n2o-framework with Apache License 2.0 | 5 votes |
@Override public void shouldHavePlaceholder(String value) { Condition condition = Condition.attribute("placeholder", value); SelenideElement elm = inputElement(); if (elm.exists()) elm.shouldHave(condition); else element().$(".n2o-editable-cell .n2o-editable-cell-text").shouldHave(condition); }
Example 6
Source File: N2oMaskedInputControl.java From n2o-framework with Apache License 2.0 | 5 votes |
@Override public void shouldHavePlaceholder(String value) { Condition condition = Condition.attribute("placeholder", value); SelenideElement elm = element().parent().$(".n2o-input-mask"); if (elm.exists()) elm.shouldHave(condition); else element().$(".n2o-editable-cell .n2o-editable-cell-text").shouldHave(condition); }
Example 7
Source File: WebPageInteractionSteps.java From akita with Apache License 2.0 | 5 votes |
/** * Скроллит страницу вниз до появления элемента каждую секунду. * Если достигнут футер страницы и элемент не найден - выбрасывается exception. */ @И("^страница прокручена до появления элемента \"([^\"]*)\"$") @When("^page has been scrolled down till the \"([^\"]*)\" element is appeared$") public void scrollWhileElemNotFoundOnPage(String elementName) { SelenideElement el = null; do { el = akitaScenario.getCurrentPage().getElement(elementName); if (el.exists()) { break; } executeJavaScript("return window.scrollBy(0, 250);"); sleep(1000); } while (!atBottom()); assertThat("Элемент " + elementName + " не найден", el.isDisplayed()); }
Example 8
Source File: N2oStandardTableHeader.java From n2o-framework with Apache License 2.0 | 5 votes |
@Override public void click() { SelenideElement elm = element().$(".n2o-checkbox"); if (elm.exists()) elm.click(); else element().$("a").should(Condition.exist).click(); }
Example 9
Source File: N2oDateInput.java From n2o-framework with Apache License 2.0 | 5 votes |
@Override public void shouldHavePlaceholder(String value) { Condition condition = Condition.attribute("placeholder", value); SelenideElement elm = inputElement(); if (elm.exists()) elm.shouldHave(condition); else cellInputElement().shouldHave(condition); }
Example 10
Source File: N2oOutputText.java From n2o-framework with Apache License 2.0 | 5 votes |
@Override public void shouldBeEmpty() { element().shouldBe(Condition.exist); SelenideElement elm = element().$(".text"); if (elm.exists()) elm.shouldBe(Condition.empty); }
Example 11
Source File: N2oInputMoney.java From n2o-framework with Apache License 2.0 | 4 votes |
@Override public String val() { SelenideElement elm = inputElement(); return elm.exists() ? elm.val() : element().$(".n2o-editable-cell .n2o-editable-cell-text").text(); }
Example 12
Source File: N2oInputMoney.java From n2o-framework with Apache License 2.0 | 4 votes |
@Override public void shouldBeEmpty() { SelenideElement elm = inputElement(); if (elm.exists()) elm.shouldHave(Condition.empty); else element().$(".n2o-editable-cell .n2o-editable-cell-text").shouldHave(Condition.empty); }
Example 13
Source File: N2oDateInput.java From n2o-framework with Apache License 2.0 | 4 votes |
@Override public void shouldBeEmpty() { SelenideElement elm = inputElement(); if (elm.exists()) elm.shouldBe(Condition.empty); else cellInputElement().shouldBe(Condition.empty); }
Example 14
Source File: N2oMaskedInputControl.java From n2o-framework with Apache License 2.0 | 4 votes |
@Override public void shouldBeEmpty() { SelenideElement elm = inputElement(); if (elm.exists()) inputElement().shouldBe(Condition.empty); else cellInputElement().shouldBe(Condition.empty); }
Example 15
Source File: N2oInputText.java From n2o-framework with Apache License 2.0 | 4 votes |
@Override public void shouldBeEmpty() { SelenideElement elm = inputElement(); if (elm.exists()) inputElement().shouldBe(Condition.empty); else cellInputElement().shouldBe(Condition.empty); }
Example 16
Source File: N2oInputText.java From n2o-framework with Apache License 2.0 | 4 votes |
@Override public String val() { SelenideElement elm = inputElement(); return elm.exists() ? elm.val() : cellInputElement().text(); }
Example 17
Source File: SideMenuImpl.java From masquerade with Apache License 2.0 | 4 votes |
protected boolean isCollapsed() { SelenideElement sideMenu = $(byChain(by, byClassName(SIDE_MENU_CONTAINER_CLASS_NAME))); return sideMenu.exists() && sideMenu.shouldBe(visible) .has(cssClass(COLLAPSED_CLASS_NAME)); }
Example 18
Source File: N2oPasswordControl.java From n2o-framework with Apache License 2.0 | 4 votes |
@Override public String val() { SelenideElement elm = inputElement(); return elm.exists() ? elm.val() : element().$(".n2o-editable-cell .n2o-editable-cell-text").text(); }
Example 19
Source File: N2oPasswordControl.java From n2o-framework with Apache License 2.0 | 4 votes |
@Override public void shouldBeEmpty() { SelenideElement elm = inputElement(); if (elm.exists()) elm.shouldHave(Condition.empty); else element().$(".n2o-editable-cell .n2o-editable-cell-text").shouldHave(Condition.empty); }
Example 20
Source File: N2oDateInput.java From n2o-framework with Apache License 2.0 | 4 votes |
@Override public String val() { SelenideElement elm = inputElement(); return elm.exists() ? elm.val() : cellInputElement().text(); }