本文整理汇总了Java中org.openqa.selenium.support.ui.Select.deselectByVisibleText方法的典型用法代码示例。如果您正苦于以下问题:Java Select.deselectByVisibleText方法的具体用法?Java Select.deselectByVisibleText怎么用?Java Select.deselectByVisibleText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.support.ui.Select
的用法示例。
在下文中一共展示了Select.deselectByVisibleText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deselectByText
import org.openqa.selenium.support.ui.Select; //导入方法依赖的package包/类
@Override
public boolean deselectByText(Element element, String text)
{
Select select = createSelect(element);
if(select != null)
{
select.deselectByVisibleText(text);
return true;
}
return false;
}
示例2: run
import org.openqa.selenium.support.ui.Select; //导入方法依赖的package包/类
@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.");
}
}
示例3: deSelect
import org.openqa.selenium.support.ui.Select; //导入方法依赖的package包/类
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;
}
}