org.openqa.selenium.support.ui.Select#deselectByValue ( )源码实例Demo

下面列出了org.openqa.selenium.support.ui.Select#deselectByValue ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: phoenix.webui.framework   文件: SeleniumSelect.java
@Override
public boolean deselectByValue(Element element, String value)
{
	Select select = createSelect(element);
	if(select != null)
	{
		select.deselectByValue(value);
		return true;
	}

	return false;
}
 
源代码2 项目: opentest   文件: DeselectListOption.java
@Override
public void run() {
    super.run();

    By locator = this.readLocatorArgument("locator");
    String optionValue = this.readStringArgument("optionValue", null);
    String optionText = this.readStringArgument("optionText", null);
    Integer optionNumber = this.readIntArgument("optionNumber", null);

    this.waitForAsyncCallsToFinish();

    Select dropdownElement = new Select(this.getElement(locator));

    if (optionValue != null) {
        dropdownElement.deselectByValue(optionValue);
    } else if (optionText != null) {
        dropdownElement.deselectByVisibleText(optionText);
    } else if (optionNumber != null) {
        dropdownElement.deselectByIndex(optionNumber - 1);
    } else {
        throw new RuntimeException(
                "You must identify the option you want to deselect from the "
                + "list by providing one of the following arguments: "
                + "optionValue, optionText or optionIndex.");
    }

}
 
private void deSelect(Select select, String Data, SelectBy selectBy) {
    switch (selectBy) {
        case Index:
            select.deselectByIndex(Integer.parseInt(Data));
            break;
        case Text:
            select.deselectByVisibleText(Data);
            break;
        case Value:
            select.deselectByValue(Data);
            break;
    }

}