MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / __init__

Method __init__

py/selenium/webdriver/support/select.py:25–42  ·  view source on GitHub ↗

Constructor. A check is made that the given element is a SELECT tag. Args: webelement: SELECT element to wrap Example: from selenium.webdriver.support.ui import Select Select(driver.find_element(By.TAG_NAME, "select")).select_by_index(2)

(self, webelement: WebElement)

Source from the content-addressed store, hash-verified

23
24class Select:
25 def __init__(self, webelement: WebElement) -> None:
26 """Constructor. A check is made that the given element is a SELECT tag.
27
28 Args:
29 webelement: SELECT element to wrap
30
31 Example:
32 from selenium.webdriver.support.ui import Select
33 Select(driver.find_element(By.TAG_NAME, "select")).select_by_index(2)
34
35 Raises:
36 UnexpectedTagNameException: If the element is not a SELECT tag
37 """
38 if webelement.tag_name.lower() != "select":
39 raise UnexpectedTagNameException(f"Select only works on <select> elements, not on {webelement.tag_name}")
40 self._el = webelement
41 multi = self._el.get_dom_attribute("multiple")
42 self.is_multiple = multi and multi != "false"
43
44 @property
45 def options(self) -> list[WebElement]:

Callers

nothing calls this directly

Calls 2

get_dom_attributeMethod · 0.45

Tested by

no test coverage detected