I'm trying to test an image with Selenium. But my problem is that image is background-image
and it doesn't have img
tag, it have this html code (it is banner from https://openweather.co.uk/products page):
<div class="current-img white-text half-section-right main-section-desktop"></div>
and this CSS styles
Is it possible to get height and width of background-image? Something like arguments[0].width
and arguments[0].height
?
Also when I try this code:
document.getElementsByClassName('current-img')[0].style.backgroundImage;
I got []
- empty (like my life) result. Despite CSS styles are present (see picture attached).
Same result with:
document.getElementsByClassName('current-img white-text half-section-right main-section-desktop')[0].style.backgroundSize
When I try:
document.getElementsByClassName('current-img white-text half-section-right main-section-desktop')[0].style
I got CSSStyleDeclaration {accentColor: '', additiveSymbols: '', alignContent: '', alignItems: '', alignSelf: '', …}
with all empty properties.
Why I got empty result?