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

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

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

Select.deselectByIndex介绍

[英]Deselect the option at the given index. This is done by examing the "index" attribute of an element, and not merely by counting.
[中]取消选择给定索引处的选项。这是通过检查元素的“索引”属性来实现的,而不仅仅是通过计数。

代码示例

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

/**
 * Wraps Selenium's method.
 *
 * @param index index to select
 * @see org.openqa.selenium.support.ui.Select#deselectByIndex(int)
 */
public void deselectByIndex(int index) {
  innerSelect.deselectByIndex(index);
}

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

/**
 * Deselect the option at the given index. This is done by examining the "index" attribute of an
 * element, and not merely by counting.
 *
 * @param index The option at this index will be deselected
 */
public void deselectByIndex(int index) {
  getSelect().deselectByIndex(index);
}

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

@Override
public LazyDomElement deselectByIndex(int index) {
 return executeSelect("deselectByIndex(" + index + ")", select -> select.deselectByIndex(index));
}

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

/**
 * Deselect the option at the given index. This is done by examining the "index" attribute of an
 * element, and not merely by counting.
 *
 * @param index The option at this index will be deselected
 */
public void deselectByIndex(int index) {
  getSelect().deselectByIndex(index);
}

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

@Override
public MultiSelect deselectByIndex(int... indexes) {
  for (int i : indexes)
    this.getWrappedSelect().deselectByIndex(i);
  return this;
}

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

@Override
public MultiSelect deselectByIndex(int... indexes) {
  for (int i : indexes)
    this.getWrappedSelect().deselectByIndex(i);
  return this;
}

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

/**
 * Deselect the option at the given index. This is done by examining the "index" attribute of an
 * element, and not merely by counting.
 *
 * @param index The option at this index will be deselected
 */
public void deselectByIndex(int index) {
  getSelect().deselectByIndex(index);
}

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

public Boolean execute() {
    getSelect().deselectByIndex(index);
    return true;
  }
}

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

@Override
public MultiSelect deselectByIndex(int... indexes) {
  for (int i : indexes)
    this.getWrappedSelect().deselectByIndex(i);
  return this;
}

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

@Override
public LazyDomElement deselectByIndex(int index) {
 return executeSelect("deselectByIndex(" + index + ")", select -> select.deselectByIndex(index));
}

代码示例来源: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: MarkusBernhardt/robotframework-selenium2library-java

select.deselectByIndex(index);

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

public WebElementFacade byIndex(int indexValue) {
    if (webElementFacade.driverIsDisabled()) { return webElementFacade; }
    webElementFacade.waitUntilElementAvailable();
    Select select = new Select(webElementFacade.getElement());
    select.deselectByIndex(indexValue);
    webElementFacade.notifyScreenChange();
    return webElementFacade;
  }
}

代码示例来源:origin: vmi/selenese-runner-java

selectUI.selectByIndex(index);
else
  selectUI.deselectByIndex(index);
break;

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

@ReplayOnError
public void deselectByIndex(final Integer index) {
  if (!isMultiple()) {
    throw new UnsupportedOperationException("You may only deselect options of a multi-select");
  }
  
  try {
    findElement();
    switch (selectType) {
      case HTML:
        select.deselectByIndex(index);
        break;
      case ANGULAR_MATERIAL:
      case LIST:
        try {
          WebElement option = options.get(index);
          setDeselected(option);
        } catch (IndexOutOfBoundsException e) {
          throw new NoSuchElementException("Cannot locate element with index: " + index);
        }
        break;
      default:
        throw new CustomSeleniumTestsException(selectType + "not recognized ");
    }
  } finally {
    finalizeAction();
  }
}

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

/**
 * Deselect the option at the given index. This is done by examing the "index" attribute of an element, and not
 * merely by counting.
 * 
 * @param index
 *            the index to deselect
 */
public void deselectByIndex(int index) {
  getDispatcher().beforeDeselect(this, index);
  
  new Select(getElement()).deselectByIndex(index);
  if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) {
    logUIActions(UIActions.CLEARED, Integer.toString(index));
  }
  
  getDispatcher().afterDeselect(this, index);
}

相关文章