1

I am unable to access the img src for all of the products. Image src attribute value returns "None" for some elements. I noticed that the image elements do not have the alt specified at times, and so the element may look like this:

<img alt src="imagesource.jpg" ...

It seems like this is creating an issue with parsing the src attribute. Is there a workaround?

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time

webdriver.DesiredCapabilities.CHROME['acceptSslCerts']=True

# Routing if using Chrome driver
driver = webdriver.Chrome()

categories = [
    "sleeping+bags",
    "sleeping+pads",
    "carabiners"
]

for category in categories:
    
  driver.get(f'https://www.backcountry.com/Store/catalog/search.jsp?s=u&q={category}')

  def get_products():
      products = driver.find_elements_by_class_name('product')
      for product in products:
          brand = product.find_element_by_class_name('ui-pl-name-brand').text
          model = product.find_element_by_class_name('ui-pl-name-title').text
          image = product.find_element_by_class_name('ui-pl-img').find_element_by_tag_name('img').get_attribute('src')

          print({ "category": category, "page": page, "brand": brand, "model": model, "image": image})

  # BEGIN EXECUTION:

  page = 1

  get_products()

  loop = True
  while loop:
      try:
          next_page = driver.find_element_by_link_text('Next Page')
          next_page.click()

          time.sleep(3)
          page += 1

          get_products()
      except:
          loop = False
3
  • are you getting any error? or whats the issue? Commented Jun 2, 2021 at 16:03
  • image value returned as "None" Commented Jun 2, 2021 at 16:14
  • For example: {'category': 'sleeping+bags', 'page': 1, 'brand': 'The North Face', 'model': 'Eco Trail Sleeping Bag: 20F Down', 'image': None, 'price': '188.95'} Where 'image' should return a url: {'category': 'sleeping+bags', 'page': 1, 'brand': 'Mountain Hardwear', 'model': "Lamina Sleeping Bag: 30F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9GH/NORBLU.jpg', 'price': '179.95'} Commented Jun 2, 2021 at 16:22

2 Answers 2

1

Your issue is that the images are not loaded when you try to grab the src attribute, so it is indeed empty. You can fix this by inducing WebDriverWait for the element to be visible before grabbing src. This is the code I used:

image = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.ui-pl-img img'))).get_attribute('src')

You need to add imports:

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

So your whole code could look like this:

from selenium import webdriver
import time
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

webdriver.DesiredCapabilities.CHROME['acceptSslCerts']=True

# Routing if using Chrome driver
driver = webdriver.Chrome()

categories = [
    "sleeping+bags",
    "sleeping+pads",
    "carabiners"
]
wait = WebDriverWait(driver, 10)
for category in categories:

  driver.get(f'https://www.backcountry.com/Store/catalog/search.jsp?s=u&q={category}')

  def get_products():
      products = driver.find_elements_by_class_name('product')
      for product in products:
          brand = product.find_element_by_class_name('ui-pl-name-brand').text
          model = product.find_element_by_class_name('ui-pl-name-title').text
          image = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.ui-pl-img img'))).get_attribute('src')

          print({ "category": category, "page": page, "brand": brand, "model": model, "image": image})

  # BEGIN EXECUTION:

  page = 1

  get_products()

  loop = True
  while loop:
      try:
          next_page = driver.find_element_by_link_text('Next Page')
          next_page.click()

          time.sleep(3)
          page += 1

          get_products()
      except:
          loop = False

And I get output like this:

{'category': 'sleeping+bags', 'page': 1, 'brand': 'The North Face', 'model': "Cat'S Meow Sleeping Bag: 20F Synthetic", 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'The North Face', 'model': 'Wasatch Sleeping Bag: 30F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'The North Face', 'model': 'Eco Trail Sleeping Bag: 0F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Coleman', 'model': 'Kompact Sleeping Bag: 40 Degree Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'The North Face', 'model': 'Eco Trail Sleeping Bag: 20F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Marmot', 'model': 'Trestles 15 Sleeping Bag: 15F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'The North Face', 'model': 'Dolomite One Sleeping Bag: 15F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Rab', 'model': "Solar 3 Synthetic Sleeping Bag - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Kelty', 'model': "Cosmic 20 Sleeping Bag: 20F Down - Men'S", 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Marmot', 'model': "Trestles 15 Sleeping Bag: 15F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Mountain Hardwear', 'model': "Lamina Sleeping Bag: 30F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Mountain Hardwear', 'model': 'Lamina Sleeping Bag: 15F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'The North Face', 'model': 'Eco Trail Sleeping Bag: 20F Down', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Mountain Hardwear', 'model': "Lamina Sleeping Bag: 0F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Marmot', 'model': "Trestles 30 Sleeping Bag: 30F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Coleman', 'model': 'Kompact Sleeping Bag: 25 Degree Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'The North Face', 'model': 'Wasatch Sleeping Bag: 0F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Marmot', 'model': 'NanoWave 25 Sleeping Bag: 25F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'ALPS Mountaineering', 'model': 'Blue Springs Sleeping Bag: 35F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Kelty', 'model': "Mistral Sleeping Bag: 20F Synthetic - Kids'", 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Mountain Hardwear', 'model': 'Lamina Sleeping Bag: 0F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Marmot', 'model': 'Trestles 0 Sleeping Bag: 0F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Mountain Hardwear', 'model': 'Lamina Eco AF Sleeping Bag: 30F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'ALPS Mountaineering', 'model': 'Double Wide Sleeping Bag: 20F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'ALPS Mountaineering', 'model': 'Crescent Lake Sleeping Bag: 20F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'NEMO Equipment Inc.', 'model': "Tempo 20 Sleeping Bag: 20F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Mountain Hardwear', 'model': 'Bozeman 15 Sleeping Bag: 15F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Mountain Hardwear', 'model': "Lamina Sleeping Bag: 15F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Marmot', 'model': 'Never Summer Sleeping Bag: 0F Down', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Stoic', 'model': 'Groundwork Single Sleeping Bag', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Rab', 'model': 'Solar 4 Synthetic Sleeping Bag', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Mountain Hardwear', 'model': 'Lamina Sleeping Bag: -20 Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'NEMO Equipment Inc.', 'model': 'Jazz Duo Sleeping Bag: 20F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Kelty', 'model': "Callisto 30 Sleeping Bag: 30F Synthetic - Kids'", 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Kelty', 'model': 'Cosmic Sleeping Bag: 0F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'The North Face', 'model': 'Eco Trail Sleeping Bag: 0F Down', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Kelty', 'model': "Mistral Sleeping Bag: 30F Synthetic - Kids'", 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Marmot', 'model': 'Trestles 30 Sleeping Bag: 30F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'ALPS Mountaineering', 'model': 'Crescent Lake Sleeping Bag: 0F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Marmot', 'model': 'NanoWave 55 Sleeping Bag: 55F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Mountain Hardwear', 'model': 'Bozeman 0 Sleeping Bag: 0F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 1, 'brand': 'Big Agnes', 'model': 'Lost Dog Sleeping Bag: 15F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/TNF/TNF03ZE/BLWITEGR.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Mountain Hardwear', 'model': 'Lamina Eco AF Sleeping Bag: 15F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Mountain Hardwear', 'model': 'Rook Sleeping Bag: 0F Down', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'The North Face', 'model': 'Blue Kazoo Sleeping Bag: 15F Down', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Kelty', 'model': "Cosmic 20 Sleeping Bag: 20F Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Kelty', 'model': "Cosmic 20 Sleeping Bag: 20F Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Big Agnes', 'model': "Sidewinder SL Sleeping Bag: 35F Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Therm-a-Rest', 'model': 'Saros Sleeping Bag: 0F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'The North Face', 'model': 'Gold Kazoo Down Sleeping Bag: 35F', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'The North Face', 'model': 'Eco Trail Sleeping Bag: 55F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Marmot', 'model': 'Ultra Elite 30 Sleeping Bag: 30F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Mountain Hardwear', 'model': "Rook Sleeping Bag: 0F Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Rab', 'model': "Solar 2 Synthetic Sleeping Bag - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'NEMO Equipment Inc.', 'model': 'Sonic -20 Sleeping Bag: -20F Down', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Marmot', 'model': 'NanoWave 45 Sleeping Bag: 45F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Marmot', 'model': 'Ultra Elite 20 Sleeping Bag: 20F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Mountain Hardwear', 'model': 'Phantom GORE-TEX Sleeping Bag: -40F Down', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Big Agnes', 'model': 'Lost Dog Sleeping Bag: 45F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Rab', 'model': 'Neutrino 800 Sleeping Bag: -5F Down', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Therm-a-Rest', 'model': 'Saros Sleeping Bag: 32F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Kelty', 'model': 'Cosmic Sleeping Bag: 40F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'The North Face', 'model': 'Eco Trail Sleeping Bag: 35F Down', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Mountain Hardwear', 'model': "Bishop Pass Sleeping Bag: 0F Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Big Agnes', 'model': 'Lost Dog Sleeping Bag: 30F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Kelty', 'model': "Tuck Sleeping Bag: 20F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'The North Face', 'model': 'Inferno Sleeping Bag: -20F Down', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'ALPS Mountaineering', 'model': 'Razor Fleece Sleeping Bag/Liner', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Marmot', 'model': 'Trestles Elite Eco 0 Sleeping Bag: 0F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Big Agnes', 'model': 'Lost Dog Sleeping Bag: 0F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Mountain Hardwear', 'model': "Bozeman Sleeping Bag: 15F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Mountain Hardwear', 'model': "Bozeman Sleeping Bag: 30F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Marmot', 'model': 'Warmcube Expedition Sleeping Bag', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Therm-a-Rest', 'model': 'Parsec Sleeping Bag: 20F Down', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Marmot', 'model': 'Micron 40 Sleeping Bag: 40F Down', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Marmot', 'model': "Banzai Trestles 35 Sleeping Bag: 35F Synthetic - Kids'", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Sea To Summit', 'model': '100% Premium Silk Sleeping Bag Liner', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'The North Face', 'model': 'Inferno Sleeping Bag: -40F Down', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'ALPS Mountaineering', 'model': 'Cosmic Quilt', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Marmot', 'model': "Teton Sleeping Bag: 15F Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Rab', 'model': 'Solar 2 Synthetic Sleeping Bag', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Mountainsmith', 'model': 'Redcloud Sleeping Bag: 20F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'The North Face', 'model': 'Green Kazoo Sleeping Bag: 0F Down', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 2, 'brand': 'Mountain Hardwear', 'model': "Rook Sleeping Bag: 15F Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHWZ9G9/UND.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Marmot', 'model': 'Yolla Bolly Doublewide 30 Sleeping Bag: 30 Degree Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Mountain Hardwear', 'model': "Rook Sleeping Bag: 15F Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Western Mountaineering', 'model': 'UltraLite Sleeping Bag: 20F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'The North Face', 'model': 'The One Sleeping Bag', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Big Agnes', 'model': 'Buell Sleeping Bag: 30F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Mountain Hardwear', 'model': 'Rook Sleeping Bag: 30F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Marmot', 'model': "Trestles 30 Sleeping Bag: 30F Synthetic - Kids'", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'NEMO Equipment Inc.', 'model': "Forte 20 Sleeping Bag: 20F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Marmot', 'model': 'Micron 50 Sleeping Bag: 50F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Marmot', 'model': 'Never Winter Sleeping Bag: 30F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Mountain Hardwear', 'model': 'Lamina Sleeping Bag: 30F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Morrison Outdoors', 'model': "Big Mo 20 Sleeping Bag - Toddlers'", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Big Agnes', 'model': 'Cabin Creek Double Sleeping Bag: 15F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Big Agnes', 'model': 'Husted Sleeping Bag: 20F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Big Agnes', 'model': 'Anvil Horn Sleeping Bag: 15F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Kelty', 'model': 'Cosmic 0 Sleeping Bag: 0F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Mountain Hardwear', 'model': 'Lamina Eco AF Sleeping Bag: 15F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Rab', 'model': 'Solar 1 Synthetic Sleeping Bag', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'NEMO Equipment Inc.', 'model': "Riff 30 Sleeping Bag: 30-Degree Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Big Agnes', 'model': 'Sleepy Bear 35 FireLine Core Sleeping Bag', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Sea To Summit', 'model': "Altitude AtI Sleeping Bag: 25F Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Big Agnes', 'model': "Sunbeam Sleeping Bag: 0F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Marmot', 'model': "Angel Fire Sleeping Bag: 25F Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Sea To Summit', 'model': 'Ember EbI Sleeping Bag: 40F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Mountain Hardwear', 'model': 'Phantom Sleeping Bag: 0F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Big Agnes', 'model': "Blue Lake Sleeping Bag: 25F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Rab', 'model': "Andes 800 Sleeping Bag: -8F Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'NEMO Equipment Inc.', 'model': "Azura 35 Sleeping Bag: 35F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'NEMO Equipment Inc.', 'model': 'Tempo 35 Sleeping Bag: 35F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Rab', 'model': 'Ascent 500 Sleeping Bag: 24F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'NEMO Equipment Inc.', 'model': 'Forte 20 Sleeping Bag: 20F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Mountain Hardwear', 'model': 'Bishop Pass Sleeping Bag: 15F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Klymit', 'model': 'Nest Sleeping Bag Liner', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Rab', 'model': 'Solar 3 Synthetic Sleeping Bag', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'NEMO Equipment Inc.', 'model': "Tempo 35 Sleeping Bag: 35F Synthetic - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Western Mountaineering', 'model': 'Versalite Sleeping Bag: 10F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'NEMO Equipment Inc.', 'model': 'Tempo 20 Sleeping Bag: 20F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Mountain Hardwear', 'model': 'Bozeman 30 Sleeping Bag: 30F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Marmot', 'model': 'Sawtooth Sleeping Bag: 15F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Western Mountaineering', 'model': 'Everlite Sleeping Bag: 45F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Rab', 'model': "Ascent 700 Sleeping Bag: 17F Down - Women'S", 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 3, 'brand': 'Marmot', 'model': 'Helium Sleeping Bag: 15F Down', 'image': 'https://content.backcountry.com/images/items/medium/MAR/MARZ9I7/BOGAKEGR.jpg'}
{'category': 'sleeping+bags', 'page': 4, 'brand': 'Mountain Hardwear', 'model': 'Phantom GORE-TEX Sleeping Bag: 0F Down', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHW01CT/ALPRD.jpg'}
{'category': 'sleeping+bags', 'page': 4, 'brand': 'Mountainsmith', 'model': 'Crestone Sleeping Bag: 0F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHW01CT/ALPRD.jpg'}
{'category': 'sleeping+bags', 'page': 4, 'brand': 'Big Agnes', 'model': "Wolverine Sleeping Bag: 15F Synthetic - Kids'", 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHW01CT/ALPRD.jpg'}
{'category': 'sleeping+bags', 'page': 4, 'brand': 'Big Agnes', 'model': 'V Notch UL Sleeping Bag: 40F Synthetic', 'image': 'https://content.backcountry.com/images/items/medium/MHW/MHW01CT/ALPRD.jpg'}
.....
Sign up to request clarification or add additional context in comments.

3 Comments

You're a rockstar! Thanks. This solution worked as needed.
Is there a particular reason time.sleep(10) does not resolve the issue in the same way, @C. Peck?
It does, but it will make your script take FOREVER. The dynamic wait from selenium will wait just as long as it needs to for the visibility of that element.
0

See if this works


productResults  = driver.find_elements_by_xpath(".//div[contains(@class,'product-grid')]/div[@aria-label='Product']")
for e in productResults:
    print(e.find_element_by_xpath(".//div[contains(@class,'img')]/img").get_attribute("src"))

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.