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);
}
}
}
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);
}
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);
}
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);
}
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();
}
Aggregations