I'm trying to scrape images from Google images . My code:
from selenium import webdriver
import time
keyword = "cats"
url = "https://www.google.com/search?q=" + keyword + "&source=lnms&tbm=isch&tbs="
driver= webdriver.Chrome()
driver.get(url)
time.sleep(5)
tags = driver.find_elements_by_xpath('//div[@id="islrg"]/div[@class="islrc"]/div/a[1]')
for tag in tags:
link = tag.get_attribute("href")
print(link)
This will print only None.
In the page source the tags have no href , I can see it only from inspect element . How can I get the href of these elements?