I am working with Selenium in Python and using Firefox web driver.
I am trying to get the SRC of an image. When I first request the SRC I get the actual image data, not the SRC
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ ...
If I run the exact same code a second time I will get the SRC
example.jpg
Here is my code
fireFoxOptions = webdriver.FirefoxOptions()
fireFoxOptions.set_headless()
browser = webdriver.Firefox(firefox_options=fireFoxOptions)
element = browser.find_element(By.ID , "idOfImageHere" )
imageUrl = element.get_attribute("src")
print("image src: " + imageUrl)
Not sure why the image data is being returned on the first time the code is ran, and then the src in the second run. It almost seems that once the image is cached then it can get the src or something like that.
Any suggestions on how to prevent the image data from being returned, just the src link?
Thanks