Extract URL of image and not base64
lomanq opened this issue · comments
Hi, i have this HTML:
<img class="active " src="https://m.media-amazon.com/images/I/61M5AtEKgrL._SS180_.jpg" width="180" height="180" title="">
I need the URL of the image: https://m.media-amazon.com/images/I/61M5AtEKgrL._SS180_.jpg
With this code:
from seleniumbase import Driver
driver_seleniumbase = Driver(uc=True)
image = driver_seleniumbase.find_element("img.active")
image_link = image.get_attribute("src")
print(image_link)
My output is a base64 image like this:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAA...
I need URL, i don't want to save image on my PC . How can i do this? Thanks
get_attribute("src")
will get you the src of the element that you found ("img.active"
), but you may need to use a better selector, because it looks like there's an earlier matching selector on that page, which is why you got a different src
than the one you expected.