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

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

本文整理了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

  1. /**
  2. * Wraps Selenium's method.
  3. *
  4. * @param index index to select
  5. * @see org.openqa.selenium.support.ui.Select#deselectByIndex(int)
  6. */
  7. public void deselectByIndex(int index) {
  8. innerSelect.deselectByIndex(index);
  9. }

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

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

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

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

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

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

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

  1. @Override
  2. public MultiSelect deselectByIndex(int... indexes) {
  3. for (int i : indexes)
  4. this.getWrappedSelect().deselectByIndex(i);
  5. return this;
  6. }

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

  1. @Override
  2. public MultiSelect deselectByIndex(int... indexes) {
  3. for (int i : indexes)
  4. this.getWrappedSelect().deselectByIndex(i);
  5. return this;
  6. }

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

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

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

  1. public Boolean execute() {
  2. getSelect().deselectByIndex(index);
  3. return true;
  4. }
  5. }

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

  1. @Override
  2. public MultiSelect deselectByIndex(int... indexes) {
  3. for (int i : indexes)
  4. this.getWrappedSelect().deselectByIndex(i);
  5. return this;
  6. }

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

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

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

  1. WebElement dropdown = driver.findElement(By.id("month"));
  2. Select select = new Select(dropdown);
  3. select.deselectByVisibleText("Aug");
  4. // or
  5. select.deselectByValue("7");
  6. // or
  7. select.deselectByIndex(8);
  8. // or
  9. select.deselectAll();

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

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

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

  1. select.deselectByIndex(index);

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

  1. public WebElementFacade byIndex(int indexValue) {
  2. if (webElementFacade.driverIsDisabled()) { return webElementFacade; }
  3. webElementFacade.waitUntilElementAvailable();
  4. Select select = new Select(webElementFacade.getElement());
  5. select.deselectByIndex(indexValue);
  6. webElementFacade.notifyScreenChange();
  7. return webElementFacade;
  8. }
  9. }

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

  1. selectUI.selectByIndex(index);
  2. else
  3. selectUI.deselectByIndex(index);
  4. break;

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

  1. @ReplayOnError
  2. public void deselectByIndex(final Integer index) {
  3. if (!isMultiple()) {
  4. throw new UnsupportedOperationException("You may only deselect options of a multi-select");
  5. }
  6. try {
  7. findElement();
  8. switch (selectType) {
  9. case HTML:
  10. select.deselectByIndex(index);
  11. break;
  12. case ANGULAR_MATERIAL:
  13. case LIST:
  14. try {
  15. WebElement option = options.get(index);
  16. setDeselected(option);
  17. } catch (IndexOutOfBoundsException e) {
  18. throw new NoSuchElementException("Cannot locate element with index: " + index);
  19. }
  20. break;
  21. default:
  22. throw new CustomSeleniumTestsException(selectType + "not recognized ");
  23. }
  24. } finally {
  25. finalizeAction();
  26. }
  27. }

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

  1. /**
  2. * Deselect the option at the given index. This is done by examing the "index" attribute of an element, and not
  3. * merely by counting.
  4. *
  5. * @param index
  6. * the index to deselect
  7. */
  8. public void deselectByIndex(int index) {
  9. getDispatcher().beforeDeselect(this, index);
  10. new Select(getElement()).deselectByIndex(index);
  11. if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) {
  12. logUIActions(UIActions.CLEARED, Integer.toString(index));
  13. }
  14. getDispatcher().afterDeselect(this, index);
  15. }

相关文章