All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.novatec.testit.webtester.pagefragments.utils.EnhancedSelect Maven / Gradle / Ivy

package info.novatec.testit.webtester.pagefragments.utils;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;


/**
 * This implementation of Selenium's {@link Select} helper class fixes some issues with the original implementation.
 * 

* Fixed Issues: *

    *
  • {@link #getFirstSelectedOption()} has very bad performance in case of great number of options
  • *
  • {@link #getAllSelectedOptions()} has very bad performance in case of great number of options
  • *
* * @since 2.0.1 */ public class EnhancedSelect extends Select { private final WebElement element; public EnhancedSelect(WebElement element) { super(element); this.element = element; } @Override public WebElement getFirstSelectedOption() { return element.findElement(By.cssSelector("option:checked")); } @Override public List getAllSelectedOptions() { return element.findElements(By.cssSelector("option:checked")); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy