This product have total five image. I am trying to get those five image links but getting only first image link. here is my code:
images = driver.find_elements_by_css_selector('#shopify-section-product-template .Image--lazyLoaded')
for image in images:
image = image.get_attribute('data-original-src')
#data-original-src contains link of each image
3
Answers
That page is initially loaded with 1 image only.
To get more images you have to scroll the page.
So without scrolling the page, getting the images with
will have only 1 element in
images
list.UPD
You can click on the dot’s navigation on the left side and then get the image:
image_src
will finally contain all the images src linksWhat is most likely happening here, is that the images are not rendered. To fix that, simply add a code snippet that will scroll to the bottom of the page, before the "find_element" function gets called.
Your are getting them all because their classes are different.
you will get first image with this:
but to get other four use : .Image–fadeIn class