get_attribute
The command to get the attribute's value with the given name.
Syntax
Element.get_attribute(attribute: str) -> bool | str | None
Usage
py.get("a").get_attribute("href")
---or--- # store in a variable
href = py.get("a").get_attribute("href")
assert href.startswith("https://")
Arguments
attribute (str)
= The name of the attribute to find in the Element
Yields
If the value is
"true"
or"false"
, then this returns a bool of True or FalseIf the name does not exist, return None
All other values are returned as strings
Last updated