本文整理了Java中org.openqa.selenium.support.ui.Select.escapeQuotes()
方法的一些代码示例,展示了Select.escapeQuotes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Select.escapeQuotes()
方法的具体详情如下:
包路径:org.openqa.selenium.support.ui.Select
类名称:Select
方法名:escapeQuotes
暂无
代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-support
/**
* Select all options that display text matching the argument. That is, when given "Bar" this
* would select an option like:
*
* <option value="foo">Bar</option>
*
* @param text The visible text to match against
*/
public void selectByVisibleText(String text) {
StringBuilder builder = new StringBuilder(".//option[. = ");
builder.append(escapeQuotes(text));
builder.append("]");
List<WebElement> options = element.findElements(By.xpath(builder.toString()));
for (WebElement option : options) {
option.setSelected();
if (isMultiple()) { return; }
}
}
代码示例来源:origin: org.seleniumhq.webdriver/webdriver-support
/**
* Select all options that have a value matching the argument. That is, when given "foo" this
* would select an option like:
*
* <option value="foo">Bar</option>
*
* @param value The value to match against
*/
public void selectByValue(String value) {
StringBuilder builder = new StringBuilder(".//option[@value = ");
builder.append(escapeQuotes(value));
builder.append("]");
List<WebElement> options = element.findElements(By.xpath(builder.toString()));
for (WebElement option : options) {
option.setSelected();
if (isMultiple()) { return; }
}
}
代码示例来源:origin: org.seleniumhq.webdriver/webdriver-support
/**
* Deselect all options that display text matching the argument. That is, when given "Bar" this
* would deselect an option like:
*
* <option value="foo">Bar</option>
*
* @param text The visible text to match against
*/
public void deselectByVisibleText(String text) {
StringBuilder builder = new StringBuilder(".//option[. = ");
builder.append(escapeQuotes(text));
builder.append("]");
List<WebElement> options = element.findElements(By.xpath(builder.toString()));
for (WebElement option : options) {
if (option.isSelected()) {
option.toggle();
}
}
}
代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-support
/**
* Select all options that have a value matching the argument. That is, when given "foo" this
* would select an option like:
*
* <option value="foo">Bar</option>
*
* @param value The value to match against
*/
public void selectByValue(String value) {
StringBuilder builder = new StringBuilder(".//option[@value = ");
builder.append(escapeQuotes(value));
builder.append("]");
List<WebElement> options = element.findElements(By.xpath(builder.toString()));
for (WebElement option : options) {
option.setSelected();
if (isMultiple()) { return; }
}
}
代码示例来源:origin: org.seleniumhq.webdriver/webdriver-support
/**
* Deselect all options that have a value matching the argument. That is, when given "foo" this
* would deselect an option like:
*
* <option value="foo">Bar</option>
*
* @param value The value to match against
*/
public void deselectByValue(String value) {
StringBuilder builder = new StringBuilder(".//option[@value = ");
builder.append(escapeQuotes(value));
builder.append("]");
List<WebElement> options = element.findElements(By.xpath(builder.toString()));
for (WebElement option : options) {
if (option.isSelected()) {
option.toggle();
}
}
}
代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-support
/**
* Deselect all options that have a value matching the argument. That is, when given "foo" this
* would deselect an option like:
*
* <option value="foo">Bar</option>
*
* @param value The value to match against
*/
public void deselectByValue(String value) {
StringBuilder builder = new StringBuilder(".//option[@value = ");
builder.append(escapeQuotes(value));
builder.append("]");
List<WebElement> options = element.findElements(By.xpath(builder.toString()));
for (WebElement option : options) {
if (option.isSelected()) {
option.toggle();
}
}
}
代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-support
/**
* Deselect all options that display text matching the argument. That is, when given "Bar" this
* would deselect an option like:
*
* <option value="foo">Bar</option>
*
* @param text The visible text to match against
*/
public void deselectByVisibleText(String text) {
StringBuilder builder = new StringBuilder(".//option[. = ");
builder.append(escapeQuotes(text));
builder.append("]");
List<WebElement> options = element.findElements(By.xpath(builder.toString()));
for (WebElement option : options) {
if (option.isSelected()) {
option.toggle();
}
}
}
代码示例来源:origin: org.seleniumhq.webdriver/webdriver-support
List<WebElement> options = element.findElements(By.xpath(".//option[. = " + escapeQuotes(text) + "]"));
for (WebElement option : options) {
option.setSelected();
} else {
candidates = element.findElements(By.xpath(".//option[contains(., " + escapeQuotes(subStringWithoutSpace) + ")]"));
内容来源于网络,如有侵权,请联系作者删除!