value-of-css-property

How to get background-image from inline css using selenium

本小妞迷上赌 提交于 2019-12-24 00:29:04
问题 Using python how can I get the background image using selenium? Which has an inline CSS? I want to get the image URL from the background-image: url() <div id="pic" class="pic" data-type="image" style=" background-image: url(http://test.com/images/image.png;); height: 306px; background-size: cover;"></div> 回答1: To get the background image you need to use value_of_css_property(property_name) method and you have to induce WebDriverWait for the visibility_of_element_located() and you can use