import pandas as pd
import selenium
from selenium import webdriver
from selenium.frequent.exceptions import NoSuchElementException
import pandas as pd
import time
driver = webdriver.Chrome(r"C:Program Recordsdata (x86)chromedriver.exe")
driver.get('https://www.amazon.in/')
search_item = driver.find_element_by_xpath("//enter[@id ='twotabsearchtextbox']")
search_item.send_keys("Laptop computer")
serch_btn = driver.find_element_by_xpath("//enter[@id='nav-search-submit-button']")
serch_btn.click on()
cpu_filter = driver.find_element_by_link_text('Intel Core i7').click on()
cpu2_filter = driver.find_element_by_link_text('Intel Core i9').click on()
href = []
lnks1=driver.find_elements_by_xpath("//a[@class="a-link-normal a-text-normal"]")
for lnk in lnks1:
href.append(lnk.get_attribute('href'))
href = href[0:10]
print(len(href))
Score = []
for i in href:
driver.get(i)
strive:
ranking = driver.find_elements_by_xpath("//*[@id='reviewsMedley']/div/div[1]/div[2]/div[1]/div/div[2]/div/span/span")
for i in ranking:
print(i.textual content)
besides:
print('-')
I’ve tried the above code, however as a result of the tenth aspect does not have any ranking, I used attempt to besides. Nevertheless, it isn’t working. It is not reverting again the sprint(-) and it’s simply printing the 9 parts.
I would like tenth aspect as sprint(-) in order that I might match up with on the time of making dataframe.
I’m not getting any thought what to do subsequent. Please assist me out with this.