List of usage examples for org.openqa.selenium.support.ui Select deselectByValue
@Override public void deselectByValue(String value)
From source file:com.mkl.websuites.internal.command.impl.select.DeselctByValueCommand.java
License:Apache License
@Override protected void doSelect(String value, Select select) { select.deselectByValue(value); }
From source file:com.pentaho.ctools.cdf.require.SelectMultiComponent.java
License:Apache License
/** * ############################### Test Case 3 ############################### * * Test Case Name:/*from w w w. j a va2s.c om*/ * Select options one by one * Description: * We pretend validate the selection of each option one by one. * Steps: * 1. Select Southern * 2. Select Eastern * 3. Select Central * 4. Select Western */ @Test public void tc3_SelectEachItem_AlertDisplayed() { this.log.info("tc3_SelectEachItem_AlertDisplayed"); // ## Step 1 wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("select"))); Select list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Southern"); wait.until(ExpectedConditions.alertIsPresent()); Alert alert = driver.switchTo().alert(); String confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern", confirmationMsg); // ## Step 2 list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.deselectByValue("Southern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); alert.accept(); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Eastern", confirmationMsg); // ## Step 3 list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.deselectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); alert.accept(); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Central"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Central", confirmationMsg); // ## Step 4 list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.deselectByValue("Central"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); alert.accept(); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Western"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Western", confirmationMsg); //RESET list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.deselectByValue("Western"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); alert.accept(); }
From source file:com.pentaho.ctools.cdf.require.SelectMultiComponent.java
License:Apache License
/** * ############################### Test Case 4 ############################### * * Test Case Name://from w w w . j a va 2s . c o m * Select and deselect all * Description: * We pretend validate the selection and deselection of all options. * Steps: * 1. Select all options * 2. Deselect all options */ @Test public void tc4_SelectAll_AlertDisplayed() { this.log.info("tc4_SelectAll_AlertDisplayed"); // ## Step 1 wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("select"))); Select list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Southern"); wait.until(ExpectedConditions.alertIsPresent()); Alert alert = driver.switchTo().alert(); String confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern", confirmationMsg); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern", confirmationMsg); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Central"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern,Central", confirmationMsg); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Western"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern,Central,Western", confirmationMsg); // ## Step 2 list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.deselectByValue("Southern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Eastern,Central,Western", confirmationMsg); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.deselectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Central,Western", confirmationMsg); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.deselectByValue("Central"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Western", confirmationMsg); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.deselectByValue("Western"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: ", confirmationMsg); }
From source file:com.pentaho.ctools.cdf.require.SelectMultiComponent.java
License:Apache License
/** * ############################### Test Case 5 ############################### * * Test Case Name:/*w w w .ja va2 s . c om*/ * Select arbitrary * Description: * We pretend validate the selection options arbitrary. * Steps: * 1. Select Arbitrary */ @Test public void tc5_SelectArbitrary_AlertDisplayed() { this.log.info("tc5_SelectArbitrary_AlertDisplayed"); // ## Step 1 wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("select"))); Select list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); Alert alert = driver.switchTo().alert(); String confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Eastern", confirmationMsg); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Central"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Eastern,Central", confirmationMsg); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Southern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern,Central", confirmationMsg); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.deselectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Central", confirmationMsg); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern,Central", confirmationMsg); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Western"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern,Central,Western", confirmationMsg); list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.deselectByValue("Central"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern,Western", confirmationMsg); }
From source file:com.pentaho.ctools.cdf.SelectMultiComponent.java
License:Apache License
/** * ############################### Test Case 3 ############################### * * Test Case Name:/*from ww w .j a va 2 s .c o m*/ * Select options one by one * Description: * We pretend validate the selection of each option one by one. * Steps: * 1. Select Southern * 2. Select Eastern * 3. Select Central * 4. Select Western */ @Test public void tc3_SelectEachItem_AlertDisplayed() { this.log.info("tc3_SelectEachItem_AlertDisplayed"); // ## Step 1 wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("select"))); Select list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Southern"); wait.until(ExpectedConditions.alertIsPresent()); Alert alert = driver.switchTo().alert(); String confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern", confirmationMsg); // ## Step 2 list.deselectByValue("Southern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); alert.accept(); list.selectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Eastern", confirmationMsg); // ## Step 3 list.deselectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); alert.accept(); list.selectByValue("Central"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Central", confirmationMsg); // ## Step 4 list.deselectByValue("Central"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); alert.accept(); list.selectByValue("Western"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Western", confirmationMsg); //RESET list.deselectByValue("Western"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); alert.accept(); }
From source file:com.pentaho.ctools.cdf.SelectMultiComponent.java
License:Apache License
/** * ############################### Test Case 4 ############################### * * Test Case Name:/*from ww w . j a va 2 s. c o m*/ * Select and deselect all * Description: * We pretend validate the selection and deselection of all options. * Steps: * 1. Select all options * 2. Deselect all options */ @Test public void tc4_SelectAll_AlertDisplayed() { this.log.info("tc4_SelectAll_AlertDisplayed"); // ## Step 1 wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("select"))); Select list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Southern"); wait.until(ExpectedConditions.alertIsPresent()); Alert alert = driver.switchTo().alert(); String confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern", confirmationMsg); list.selectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern", confirmationMsg); list.selectByValue("Central"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern,Central", confirmationMsg); list.selectByValue("Western"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern,Central,Western", confirmationMsg); // ## Step 2 list.deselectByValue("Southern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Eastern,Central,Western", confirmationMsg); list.deselectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Central,Western", confirmationMsg); list.deselectByValue("Central"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Western", confirmationMsg); list.deselectByValue("Western"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: ", confirmationMsg); }
From source file:com.pentaho.ctools.cdf.SelectMultiComponent.java
License:Apache License
/** * ############################### Test Case 5 ############################### * * Test Case Name:/*from w w w.j av a 2 s . c o m*/ * Select arbitrary * Description: * We pretend validate the selection options arbitrary. * Steps: * 1. Select Arbitrary */ @Test public void tc5_SelectArbitrary_AlertDisplayed() { this.log.info("tc5_SelectArbitrary_AlertDisplayed"); // ## Step 1 wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("select"))); Select list = new Select(this.elemHelper.FindElement(driver, By.cssSelector("select"))); list.selectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); Alert alert = driver.switchTo().alert(); String confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Eastern", confirmationMsg); list.selectByValue("Central"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Eastern,Central", confirmationMsg); list.selectByValue("Southern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern,Central", confirmationMsg); list.deselectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Central", confirmationMsg); list.selectByValue("Eastern"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern,Central", confirmationMsg); list.selectByValue("Western"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern,Central,Western", confirmationMsg); list.deselectByValue("Central"); wait.until(ExpectedConditions.alertIsPresent()); alert = driver.switchTo().alert(); confirmationMsg = alert.getText(); alert.accept(); assertEquals("you chose: Southern,Eastern,Western", confirmationMsg); }
From source file:net.sourceforge.jwebunit.webdriver.WebDriverTestingEngineImpl.java
License:Open Source License
public void unselectOptions(String selectName, int index, String[] optionValues) { Select select = new Select(getWebElementByXPath( "//select[@name=" + escapeQuotes(selectName) + "][" + (index + 1) + "]", true, true)); if (!select.isMultiple() && optionValues.length > 1) throw new RuntimeException("Multiselect not enabled"); for (String option : optionValues) { boolean found = false; for (WebElement opt : select.getOptions()) { if (opt.getAttribute("value").equals(option)) { select.deselectByValue(option); found = true;/*from w w w.ja v a 2s. co m*/ break; } } if (!found) { throw new RuntimeException("Option " + option + " not found"); } } }
From source file:org.musetest.selenium.steps.DeselectOptionByValue.java
License:Open Source License
@Override protected void executeSelection(Select select, String option, StepExecutionContext context) { select.deselectByValue(option); }
From source file:org.xmlium.test.web.commons.xml.XMLTestSteps.java
License:LGPL
protected void selectBy(Select select, Object objectSelectBy) { if (objectSelectBy instanceof SelectBy) { SelectBy selectBy = (SelectBy) objectSelectBy; if (selectBy.getByVisibleText() != null) { select.selectByVisibleText(selectBy.getByVisibleText()); }/* w w w .ja va 2 s .co m*/ } else if (objectSelectBy instanceof PrettySelectBy) { PrettySelectBy selectBy = (PrettySelectBy) objectSelectBy; select.deselectByValue(selectBy.getByVisibleText()); } else { throw new RuntimeException("unknow SelectBy: " + objectSelectBy.getClass().getName()); } }