我怎样才能得到div的背景图片url,它包含在Selenium中使用类名的div中

2024-09-27 23:27:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我想从Trullia帖子中得到图片,它们都是通过具有背景图片的类名分配给div的。 我该怎么办?你知道吗

.kMqQpn {
    background-image: url(https://www.trulia.com/pictures/thumbs_6/zillowstatic/ISukfi6equ5pf41000000000.jpg);
    background-color: rgb(0, 0, 0);
    background-size: contain;
    height: 100%;
    display: flex;
    background-repeat: no-repeat;
    background-position: center center;
    flex: 1 1 0%;
}
<div class="SlideWrapper__Container-sc-8vknhi-0 ekTitK"><div data-testid="media-carousel-image-0" class="MediaCarouselSlide__MediaCarouselImage-vvght3-0 kMqQpn"></div></div>

您可以看到,inner div是动态更改类名的,所以获取背景图像的解决方案是什么。 谢谢


Tags: httpsimagedivurl图片帖子classflex

热门问题