"What's the best way to verify a webelement has attribute using Python?"
Hey folks!
Stuck on how to check if a webelement has attribute in Python with Selenium? Like, I need to see if an element has a 'data-id' or 'class' attr before doing stuff with it.
Tried `get_attribute()`, but it returns `None` if the attr doesn't exist. Is there a cleaner way than checking for `None`? Or maybe a built-in method I’m missing?
Kinda new to this, so any tips or snippets would be awesome!
Thanks in advance!
(PS: Googled "webelement has attribute python" but didn’t find a straight answer.)
Hey folks!
Stuck on how to check if a webelement has attribute in Python with Selenium? Like, I need to see if an element has a 'data-id' or 'class' attr before doing stuff with it.
Tried `get_attribute()`, but it returns `None` if the attr doesn't exist. Is there a cleaner way than checking for `None`? Or maybe a built-in method I’m missing?
Kinda new to this, so any tips or snippets would be awesome!
Thanks in advance!
(PS: Googled "webelement has attribute python" but didn’t find a straight answer.)
