Pro tip: If you’re using pytest or unittest, you could even make a custom assertion for this.
Something like:
```python
def assert_has_attribute(element, attr_name):
assert element.get_attribute(attr_name) is not None, f"Missing {attr_name}"
```
Makes your tests cleaner if you’re doing lots of checks. For webelement has attribute python, this is a neat way to keep things DRY.
Something like:
```python
def assert_has_attribute(element, attr_name):
assert element.get_attribute(attr_name) is not None, f"Missing {attr_name}"
```
Makes your tests cleaner if you’re doing lots of checks. For webelement has attribute python, this is a neat way to keep things DRY.
