org.openqa.selenium.support.ui.Select.deselectByVisibleText()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中org.openqa.selenium.support.ui.Select.deselectByVisibleText()方法的一些代码示例,展示了Select.deselectByVisibleText()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Select.deselectByVisibleText()方法的具体详情如下:
包路径:org.openqa.selenium.support.ui.Select
类名称:Select
方法名:deselectByVisibleText

Select.deselectByVisibleText介绍

[英]Deselect all options that display text matching the argument. That is, when given "Bar" this would deselect an option like: <option value="foo">Bar</option>
[中]取消选择显示与参数匹配的文本的所有选项。也就是说,当给定“Bar”时,这将取消选择一个选项,如:<option value=“foo”>Bar</option>

代码示例

代码示例来源:origin: elisarver/selophane

/**
 * Wraps Selenium's method.
 *
 * @param text text to deselect by visible text
 * @see org.openqa.selenium.support.ui.Select#deselectByVisibleText(String)
 */
public void deselectByVisibleText(String text) {
  innerSelect.deselectByVisibleText(text);
}

代码示例来源:origin: ru.yandex.qatools.htmlelements/htmlelements-java

/**
   * Deselect all options that display text matching the argument. That is, when given "Bar" this
   * would deselect an option like:
   * <p/>
   * &lt;option value="foo"&gt;Bar&lt;/option&gt;
   *
   * @param text The visible text to match against
   */
  public void deselectByVisibleText(String text) {
    getSelect().deselectByVisibleText(text);
  }
}

代码示例来源:origin: org.seleniumhq.selenium.fluent/fluent-selenium

public Boolean execute() {
    getSelect().deselectByVisibleText(text);
    return true;
  }
}

代码示例来源:origin: com.github.wiselenium/wiselenium-core

@Override
public MultiSelect deselectByVisibleText(String... texts) {
  for (String t : texts)
    this.getWrappedSelect().deselectByVisibleText(t);
  return this;
}

代码示例来源:origin: com.github.wiselenium/wiselenium-elements

@Override
public MultiSelect deselectByVisibleText(String... texts) {
  for (String t : texts)
    this.getWrappedSelect().deselectByVisibleText(t);
  return this;
}

代码示例来源:origin: yandex-qatools/htmlelements

/**
   * Deselect all options that display text matching the argument. That is, when given "Bar" this
   * would deselect an option like:
   * <p/>
   * &lt;option value="foo"&gt;Bar&lt;/option&gt;
   *
   * @param text The visible text to match against
   */
  public void deselectByVisibleText(String text) {
    getSelect().deselectByVisibleText(text);
  }
}

代码示例来源:origin: ru.sbtqa.htmlelements/htmlelements-java

/**
   * Deselect all options that display text matching the argument. That is, when given "Bar" this
   * would deselect an option like:
   * 
   * &lt;option value="foo"&gt;Bar&lt;/option&gt;
   *
   * @param text The visible text to match against
   */
  public void deselectByVisibleText(String text) {
    getSelect().deselectByVisibleText(text);
  }
}

代码示例来源:origin: wiselenium/wiselenium

@Override
public MultiSelect deselectByVisibleText(String... texts) {
  for (String t : texts)
    this.getWrappedSelect().deselectByVisibleText(t);
  return this;
}

代码示例来源:origin: com.github.webdriverextensions/webdriverextensions

public static void deselectOption(String text, WebElement webElement) {
  new Select(webElement).deselectByVisibleText(text);
}

代码示例来源:origin: viltgroup/minium

@Override
  protected void doPerform() {
    getSelectElement().deselectByVisibleText(text);
  }
}

代码示例来源:origin: net.code-story/simplelenium

@Override
public LazyDomElement deselectByVisibleText(String text) {
 return executeSelect("deselectByVisibleText(" + text + ")", select -> select.deselectByVisibleText(text));
}

代码示例来源:origin: dgageot/simplelenium

@Override
public LazyDomElement deselectByVisibleText(String text) {
 return executeSelect("deselectByVisibleText(" + text + ")", select -> select.deselectByVisibleText(text));
}

代码示例来源:origin: webdriverextensions/webdriverextensions

public static void deselectOption(String text, WebElement webElement) {
  new Select(webElement).deselectByVisibleText(text);
}

代码示例来源:origin: stackoverflow.com

WebElement dropdown = driver.findElement(By.id("month"));
Select select = new Select(dropdown);
select.deselectByVisibleText("Aug");
// or
select.deselectByValue("7");
// or
select.deselectByIndex(8);
// or
select.deselectAll();

代码示例来源:origin: selenium-cucumber/selenium-cucumber-java

/** Method to unselect option from dropdwon list
@param accessType : String : Locator type (id, name, class, xpath, css)
@param accessName : String : Locator value
*/
public void deselectOptionFromDropdown(String accessType, String optionBy, String option, String accessName) 
{
  dropdown = wait.until(ExpectedConditions.presenceOfElementLocated(getelementbytype(accessType, accessName)));
  selectList = new Select(dropdown);
  
  if(optionBy.equals("selectByIndex"))
    selectList.deselectByIndex(Integer.parseInt(option)-1);
  else if (optionBy.equals("value"))
    selectList.deselectByValue(option);
  else if (optionBy.equals("text"))
    selectList.deselectByVisibleText(option);
}

代码示例来源:origin: com.infotel.seleniumRobot/core

private void setDeselected(final WebElement option) {
    switch (selectType) {
      case ANGULAR_MATERIAL:
        if ("true".equals(option.getAttribute("aria-selected"))) {
          HtmlElement checkbox = ((HtmlElement)((CachedHtmlElement)option).getRealElement()).findElement(By.tagName("mat-pseudo-checkbox"));
          if (checkbox.isElementPresent(0)) {
            checkbox.click();
          } else {
            ((CachedHtmlElement)option).getRealElement().click();
          }
        }
        break;
      case HTML:
        select.deselectByVisibleText(option.getText());
        break;
      case LIST:
        throw new ScenarioException("Cannot deselect for list based select");
      default:
        throw new CustomSeleniumTestsException(selectType + "not recognized ");
    }
  }
}

代码示例来源:origin: net.serenity-bdd/serenity-core

public WebElementFacade byVisibleText(String label) {
  if (webElementFacade.driverIsDisabled()) { return webElementFacade; }
  webElementFacade.waitUntilElementAvailable();
  Select select = new Select(webElementFacade.getElement());
  select.deselectByVisibleText(label);
  webElementFacade.notifyScreenChange();
  return webElementFacade;
}

代码示例来源:origin: com.infotel.seleniumRobot/core

switch (selectType) {
  case HTML:
    select.deselectByVisibleText(text);
    break;
  case ANGULAR_MATERIAL:

代码示例来源:origin: MarkusBernhardt/robotframework-selenium2library-java

/**
 * Unselect the given <b>*labels</b> of the multi-select list identified by
 * <b>locator</b>.<br>
 * <br>
 * Select list keywords work on both lists and combo boxes. Key attributes
 * for select lists are id and name. See `Introduction` for details about
 * locators.<br>
 * 
 * @param locator
 *            The locator to locate the multi-select list.
 * @param labels
 *            The list of labels to select
 */
@RobotKeyword
@ArgumentNames({ "locator", "*labels" })
public void unselectFromListByLabel(String locator, String... labels) {
  if (labels.equals(null)) {
    throw new Selenium2LibraryNonFatalException("No value given.");
  }
  String items = String.format("label(s) '%s'", Python.join(", ", labels));
  logging.info(String.format("Unselecting %s from list '%s'.", items, locator));
  Select select = getSelectList(locator);
  if (!isMultiselectList(select)) {
    throw new Selenium2LibraryNonFatalException(
        "Keyword 'Unselect from list' works only for multiselect lists.");
  }
  for (String label : labels) {
    select.deselectByVisibleText(label);
  }
}

代码示例来源:origin: paypal/SeLion

/**
   * Deselect all options that display text matching the argument.
   * 
   * @param label
   *            the label to deselect
   */
  public void deselectByLabel(String label) {
    getDispatcher().beforeDeselect(this, label);
    
    new Select(getElement()).deselectByVisibleText(label);
    if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) {
      logUIActions(UIActions.CLEARED, label);
    }
    
    getDispatcher().afterDeselect(this, label);
  }
}

相关文章