Java Code Examples for com.codeborne.selenide.SelenideElement#is()

The following examples show how to use com.codeborne.selenide.SelenideElement#is() . 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: OptionsGroupImpl.java    From masquerade with Apache License 2.0 6 votes vote down vote up
@Override
public String getSelectedValue() {
    impl.shouldBe(visible);

    SelenideElement selectedOpt = $(byChain(by, SELECTED_OPTION));
    if (selectedOpt.is(visible)) {
        return selectedOpt.getText();
    } else {
        return null;
    }
}
 
Example 2
Source File: N2oSelect.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public void optionShouldHaveDescription(String option, String description) {
    expandPopUpOptions();
    SelenideElement elm = selectPopUp().$$("button .text-cropped,.custom-control-label")
            .findBy(Condition.text(option)).parent();
    if (elm.is(Condition.cssClass("custom-checkbox")))
        elm = elm.parent();
    elm.$(".dropdown-header").shouldHave(Condition.text(description));
}
 
Example 3
Source File: N2oInputSelect.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public void optionShouldHaveDescription(String option, String description) {
    expandPopUpOptions();
    SelenideElement elm = selectPopUp().$$("button .text-cropped,.custom-control-label")
            .findBy(Condition.text(option)).parent();
    if (elm.is(Condition.cssClass("custom-checkbox")))
        elm = elm.parent();
    elm.$(".dropdown-header").shouldHave(Condition.text(description));
}
 
Example 4
Source File: CheckBoxImpl.java    From masquerade with Apache License 2.0 5 votes vote down vote up
@Override
public CheckBox setChecked(boolean checked) {
    SelenideElement checkBoxInput = $(byChain(by, INPUT))
            .shouldBe(visible)
            .shouldBe(enabled);

    if (checked != checkBoxInput.is(CHECKBOX_CHECKED)) {
        checkBoxInput.sendKeys(Keys.SPACE);
    }

    return this;
}
 
Example 5
Source File: OptionsGroupImpl.java    From masquerade with Apache License 2.0 5 votes vote down vote up
@Override
public int getSelectedIndex() {
    impl.shouldBe(visible);

    SelenideElement selectedOpt = $(byChain(by, SELECTED_OPTION));
    if (!selectedOpt.is(visible)) {
        return -1;
    }

    List<String> texts = $$(byChain(by, OPTION_LABEL)).texts();

    return texts.indexOf(selectedOpt.getText());
}
 
Example 6
Source File: NotificationImpl.java    From masquerade with Apache License 2.0 5 votes vote down vote up
@Override
public String getCaption() {
    impl.shouldBe(visible);

    SelenideElement captionImpl = $(byChain(by, NOTIFICATION_CAPTION));
    if (captionImpl.is(visible)) {
        return captionImpl.getText();
    } else {
        return null;
    }
}
 
Example 7
Source File: NotificationImpl.java    From masquerade with Apache License 2.0 5 votes vote down vote up
@Override
public String getDescription() {
    impl.shouldBe(visible);

    SelenideElement descriptionImpl = $(byChain(by, NOTIFICATION_DESCRIPTION));
    if (descriptionImpl.is(visible)) {
        return descriptionImpl.getText();
    } else {
        return null;
    }
}
 
Example 8
Source File: N2oSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void expandPopUpOptions() {
    SelenideElement elm = element().$(".n2o-popup-control");
    if (!elm.is(Condition.cssClass("isExpanded")))
        elm.click();
}
 
Example 9
Source File: N2oSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void collapsePopUpOptions() {
    SelenideElement elm = element().$(".n2o-popup-control");
    if (elm.is(Condition.cssClass("isExpanded")))
        elm.click();
}
 
Example 10
Source File: N2oInputText.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
private SelenideElement inputMeasure() {
    SelenideElement elm = element().parent();
    if (elm.is(Condition.cssClass("n2o-input-number")))
        elm = elm.parent();
    return elm.$(".n2o-control-container-placeholder");
}
 
Example 11
Source File: N2oInputSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void expandPopUpOptions() {
    SelenideElement elm = element().$(".n2o-popup-control");
    if (!elm.is(Condition.cssClass("isExpanded")))
        elm.click();
}
 
Example 12
Source File: N2oInputSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void collapsePopUpOptions() {
    SelenideElement elm = element().$(".n2o-popup-control");
    if (elm.is(Condition.cssClass("isExpanded")))
        elm.click();
}