Actually I would like to fetch the CSS class block
HTML Code:
<a id="fld_2418083_6_opt1730754" data-label="F°" data-field="fld_2418083" data-active="btn-primary" data-default="btn-default" class="btn btn-primary" data-value="0" aria-labelledby="fld_2418083Label" title="Choose OptionF°">F°</a>
CSS Code:
.btn-primary{ background-color: #438bca; }
I have tried this piece of code for fetching the CSS block in python with selenium but I got an error of
cls_name = element.get_attribute("class") bg_color = cls_name.value_of_css_property("background-color") print(f'{ bg_color = }')
Expecting the output is
background-color: #438bca
aliceblue