Skip to content

Instantly share code, notes, and snippets.

@chayb
Last active February 2, 2023 14:11
Show Gist options
  • Save chayb/ce1ffde1493c354cfc47b2ebd1e5c7dd to your computer and use it in GitHub Desktop.
Save chayb/ce1ffde1493c354cfc47b2ebd1e5c7dd to your computer and use it in GitHub Desktop.
Web scrape amazon.in TV links
#importing libraries
import selenium
from selenium import webdriver as wb
from selenium.webdriver.support.ui import Select
import pandas as pd
import time
#Opening Chrome browser
wbD=wb.Chrome('chromedriver.exe')
#Opening webpage
wbD.get('https://www.amazon.in/s?bbn=1389396031&rh=n%3A976419031%2Cn%3A%21976420031%2Cn%3A1389375031%2Cn%3A1389396031%2Cn%3A15747864031&dc&fst=as%3Aoff&qid=1596287247&rnid=1389396031&ref=lp_1389396031_nr_n_1')
#Running loop to store the product links in a list
listOflinks =[]
condition =True
while condition:
time.sleep(3)
productInfoList=webD.find_elements_by_class_name('a-size-mini')
for el in productInfoList:
if(el.text !="" and el.text !="Sponsored"):
pp2=el.find_element_by_tag_name('a')
listOflinks.append(pp2.get_property('href'))
try:
wbD.find_element_by_class_name('a-last').find_element_by_tag_name('a').get_property('href')
wbD.find_element_by_class_name('a-last').click()
except:
condition=False
len(listOflinks)
@zaidyousaf
Copy link

By running this code i am getting the below error attached in PNG.
How to fix it?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment