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

Method delete_cookie

py/selenium/webdriver/remote/webdriver.py:862–875  ·  view source on GitHub ↗

Delete a single cookie with the given name (case-sensitive). Raises: ValueError if the name is empty or whitespace. Example: `driver.delete_cookie("my_cookie")`

(self, name)

Source from the content-addressed store, hash-verified

860 return None
861
862 def delete_cookie(self, name) -> None:
863 """Delete a single cookie with the given name (case-sensitive).
864
865 Raises:
866 ValueError if the name is empty or whitespace.
867
868 Example:
869 `driver.delete_cookie("my_cookie")`
870 """
871 # Firefox deletes all cookies when "" is passed as name
872 if not name or name.isspace():
873 raise ValueError("Cookie name cannot be empty")
874
875 self.execute(Command.DELETE_COOKIE, {"name": name})
876
877 def delete_all_cookies(self) -> None:
878 """Delete all cookies in the scope of the session."""

Calls 1

executeMethod · 0.95