本文整理汇总了Python中selenium.webdriver.support.select.Select.deselect_by_value方法的典型用法代码示例。如果您正苦于以下问题:Python Select.deselect_by_value方法的具体用法?Python Select.deselect_by_value怎么用?Python Select.deselect_by_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium.webdriver.support.select.Select
的用法示例。
在下文中一共展示了Select.deselect_by_value方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove_selection
# 需要导入模块: from selenium.webdriver.support.select import Select [as 别名]
# 或者: from selenium.webdriver.support.select.Select import deselect_by_value [as 别名]
def remove_selection(self, locator, optionLocator):
el = self.driver.find_element(self.getBy(selectLocator), self.getValue(selectLocator))
select = Select(el)
logging.debug(select.options)
if "label=" in optionLocator:
select.deselect_by_visible_text(optionLocator[6:])
elif "value=" in optionLocator:
select.deselect_by_value(optionLocator[6:])
示例2: deselect_option
# 需要导入模块: from selenium.webdriver.support.select import Select [as 别名]
# 或者: from selenium.webdriver.support.select.Select import deselect_by_value [as 别名]
def deselect_option(self, value=None, text=None, index=None):
if len(list(filter(None, (value, text, index)))) != 1:
raise ValueError("You must supply exactly one of (value, text, index) kwargs")
select = Select(self)
if value is not None:
select.deselect_by_value(value)
elif text is not None:
select.deselect_by_visible_text(text)
else:
select.deselect_by_index(index)
示例3: __delitem__
# 需要导入模块: from selenium.webdriver.support.select import Select [as 别名]
# 或者: from selenium.webdriver.support.select.Select import deselect_by_value [as 别名]
def __delitem__(self, key):
s = WebDriverSelect(self.driver.find_element_by_locator(self.locator))
method = key[:key.find("=")]
value = key[key.find("=") + 1:]
if method == "value":
s.deselect_by_value(value)
elif method == "index":
s.deselect_by_index(value)
elif method == "text":
s.deselect_by_visible_text(value)
else:
raise saunter.exceptions.InvalidLocatorString("%s is an invalid locator" % item)