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

Method clear

py/selenium/webdriver/remote/webelement.py:143–150  ·  view source on GitHub ↗

Clears the text if it's a text entry element. Example: text_field = driver.find_element(By.NAME, "username") text_field.clear()

(self)

Source from the content-addressed store, hash-verified

141 raise WebDriverException("To submit an element, it must be nested inside a form element") from exc
142
143 def clear(self) -> None:
144 """Clears the text if it's a text entry element.
145
146 Example:
147 text_field = driver.find_element(By.NAME, "username")
148 text_field.clear()
149 """
150 self._execute(Command.CLEAR_ELEMENT)
151
152 def get_property(self, name: str) -> str | bool | WebElement | dict:
153 """Gets the given property of the element.

Callers

nothing calls this directly

Calls 1

_executeMethod · 0.95

Tested by

no test coverage detected