Search in sources :

Example 1 with ElementsCollection

use of com.codeborne.selenide.ElementsCollection in project syndesis-qe by syndesisio.

the class Form method fill.

public void fill(Map<String, String> data) {
    if (data.isEmpty()) {
        throw new IllegalArgumentException("can't find any connection details in connection");
    }
    ElementsCollection inputs = getRootElement().findAll(By.cssSelector("input"));
    List<String> keys = new ArrayList<String>();
    for (SelenideElement input : inputs) {
        String name = input.getAttribute("name");
        keys.add(name);
    }
    for (String key : data.keySet()) {
        if (keys.contains(key)) {
            log.info("fill connection Details detail {} ", key);
            SelenideElement input = getRootElement().$(String.format("input[name=\"%s\"", key)).shouldBe(visible);
            input.clear();
            input.sendKeys(data.get(key));
        } else {
            log.info("Input {} is not present on form!", key);
        }
    }
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection) SelenideElement(com.codeborne.selenide.SelenideElement) ArrayList(java.util.ArrayList)

Example 2 with ElementsCollection

use of com.codeborne.selenide.ElementsCollection in project syndesis-qe by syndesisio.

the class SyndesisPageObject method getElementRandom.

public SelenideElement getElementRandom(String elementClassName) {
    ElementsCollection elements = this.getElementsByClassName(elementClassName);
    int index = (int) Math.floor(Math.random() * elements.size());
    return elements.get(index);
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection)

Example 3 with ElementsCollection

use of com.codeborne.selenide.ElementsCollection in project syndesis-qe by syndesisio.

the class SyndesisPageObject method getFirstVisibleButton.

public SelenideElement getFirstVisibleButton(String buttonTitle) {
    log.info("searching for first visible button {}", buttonTitle);
    ElementsCollection buttonElements = this.getRootElement().findAll(By.linkText(buttonTitle)).filter(visible);
    return buttonElements.get(0);
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection)

Example 4 with ElementsCollection

use of com.codeborne.selenide.ElementsCollection in project syndesis-qe by syndesisio.

the class SyndesisPageObject method getLinkRandom.

public SelenideElement getLinkRandom(String linkTitle) {
    ElementsCollection links = this.getLinks(linkTitle);
    int index = (int) Math.floor(Math.random() * links.size());
    return links.get(index);
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection)

Example 5 with ElementsCollection

use of com.codeborne.selenide.ElementsCollection in project syndesis-qe by syndesisio.

the class IntegrationDetailPage method selectTab.

public void selectTab(String tabName) {
    ElementsCollection allTabs = $(Element.ROOT).findAll(Element.TAB).shouldBe(sizeGreaterThan(0));
    allTabs.stream().filter(s -> tabName.equals(s.getText())).findFirst().get().shouldBe(visible).click();
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection)

Aggregations

ElementsCollection (com.codeborne.selenide.ElementsCollection)31 SelenideElement (com.codeborne.selenide.SelenideElement)15 ArrayList (java.util.ArrayList)9 Then (cucumber.api.java.en.Then)4 When (cucumber.api.java.en.When)2 StepComponent (io.syndesis.qe.pages.integrations.edit.steps.StepComponent)2 Given (cucumber.api.java.en.Given)1 ModalDialogPage (io.syndesis.qe.pages.ModalDialogPage)1 Connections (io.syndesis.qe.pages.connections.Connections)1 BasicFilterStepComponent (io.syndesis.qe.pages.integrations.edit.steps.BasicFilterStepComponent)1 ConfigureConnectionSteps (io.syndesis.qe.steps.connections.wizard.phases.ConfigureConnectionSteps)1 NameConnectionSteps (io.syndesis.qe.steps.connections.wizard.phases.NameConnectionSteps)1 List (java.util.List)1