Search in sources :

Example 1 with Select

use of org.openqa.selenium.support.ui.Select in project zeppelin by apache.

the class InterpreterIT method testShowDescriptionOnInterpreterCreate.

@Test
public void testShowDescriptionOnInterpreterCreate() throws Exception {
    if (!endToEndTestEnabled()) {
        return;
    }
    try {
        // navigate to interpreter page
        WebElement settingButton = driver.findElement(By.xpath("//button[@class='nav-btn dropdown-toggle ng-scope']"));
        settingButton.click();
        WebElement interpreterLink = driver.findElement(By.xpath("//a[@href='#/interpreter']"));
        interpreterLink.click();
        WebElement createButton = driver.findElement(By.xpath("//button[contains(., 'Create')]"));
        createButton.click();
        Select select = new Select(driver.findElement(By.xpath("//select[@ng-change='newInterpreterGroupChange()']")));
        select.selectByVisibleText("spark");
        collector.checkThat("description of interpreter property is displayed", driver.findElement(By.xpath("//tr/td[contains(text(), 'spark.app.name')]/following-sibling::td[2]")).getText(), CoreMatchers.equalTo("The name of spark application."));
    } catch (Exception e) {
        handleException("Exception in InterpreterIT while testShowDescriptionOnInterpreterCreate ", e);
    }
}
Also used : Select(org.openqa.selenium.support.ui.Select) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

Example 2 with Select

use of org.openqa.selenium.support.ui.Select in project zeppelin by apache.

the class ParagraphActionsIT method testWidth.

@Test
public void testWidth() throws Exception {
    if (!endToEndTestEnabled()) {
        return;
    }
    try {
        createNewNote();
        waitForParagraph(1, "READY");
        collector.checkThat("Default Width is 12 ", driver.findElement(By.xpath("//div[contains(@class,'col-md-12')]")).isDisplayed(), CoreMatchers.equalTo(true));
        for (Integer newWidth = 1; newWidth <= 11; newWidth++) {
            clickAndWait(By.xpath(getParagraphXPath(1) + "//span[@class='icon-settings']"));
            String visibleText = newWidth.toString();
            new Select(driver.findElement(By.xpath(getParagraphXPath(1) + "//ul/li/a/form/select[(@ng-model='paragraph.config.colWidth')]"))).selectByVisibleText(visibleText);
            collector.checkThat("New Width is : " + newWidth, driver.findElement(By.xpath("//div[contains(@class,'col-md-" + newWidth + "')]")).isDisplayed(), CoreMatchers.equalTo(true));
        }
        deleteTestNotebook(driver);
    } catch (Exception e) {
        handleException("Exception in ParagraphActionsIT while testWidth ", e);
    }
}
Also used : Select(org.openqa.selenium.support.ui.Select) Test(org.junit.Test)

Example 3 with Select

use of org.openqa.selenium.support.ui.Select in project java.webdriver by sayems.

the class MultiSelect method isTextPresentInTheDropdown.

public boolean isTextPresentInTheDropdown(Supplier<By> by, String text) {
    final Element element = untilFound(by);
    Select dropdown = new Select(element);
    return dropdown.getOptions().parallelStream().anyMatch(opt -> opt.getText().contains(text));
}
Also used : WebElement(org.openqa.selenium.WebElement) Select(org.openqa.selenium.support.ui.Select)

Example 4 with Select

use of org.openqa.selenium.support.ui.Select in project java.webdriver by sayems.

the class MultiSelect method selectByIndex.

public MultiSelect selectByIndex(Supplier<By> by, Integer... indices) {
    Select select = new Select(findElement(by));
    select.deselectAll();
    Arrays.stream(indices).forEach(select::selectByIndex);
    return this;
}
Also used : Select(org.openqa.selenium.support.ui.Select)

Example 5 with Select

use of org.openqa.selenium.support.ui.Select in project java.webdriver by sayems.

the class Action method selectDropdown.

// Method to select value from drop down based on visible text
public void selectDropdown(Supplier<By> by, String value) {
    WebElement locator = driver.findElement(by.get());
    Select dropdown = new Select(locator);
    dropdown.selectByVisibleText(value);
}
Also used : Select(org.openqa.selenium.support.ui.Select) WebElement(org.openqa.selenium.WebElement)

Aggregations

Select (org.openqa.selenium.support.ui.Select)48 WebElement (org.openqa.selenium.WebElement)19 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)11 NoSuchElementException (org.openqa.selenium.NoSuchElementException)8 PublicAtsApi (com.axway.ats.common.PublicAtsApi)6 RealHtmlElementState (com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState)6 SeleniumOperationException (com.axway.ats.uiengine.exceptions.SeleniumOperationException)5 Test (org.junit.Test)5 WebDriver (org.openqa.selenium.WebDriver)4 Predicate (com.google.common.base.Predicate)3 Arrays (java.util.Arrays)3 List (java.util.List)3 Supplier (java.util.function.Supplier)3 Collectors (java.util.stream.Collectors)3 By (org.openqa.selenium.By)3 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)3 org.openqa.selenium (org.openqa.selenium)2 ArrayList (java.util.ArrayList)1 Test (org.testng.annotations.Test)1