Skip to content
Advertisement

Performing web scraping using selenium on influenster.com. I am getting just one scraped review even though it was in loop and the xpath was correct

JavaScript

OUTPUT IS JUST ONE NAME AND NOT ALL I need to scrape all the reviews from https://www.influenster.com/reviews/loreal-paris-elvive-extraordinary-oil-deep-nourishing-shampoo-and-conditioner-set-126-fl-oz. Even I am running a loop I am getting only one username. Please help me out

Advertisement

Answer

You getting only 1 review because XPath locator you are using //*[@id="app-base"]/div[1]/div[4]/div[1]/div[1]/div[3] returns only 1 element, so your for loop is performed only once.
You can improve this code by improving that XPath locator.
Also you need to close the cookies banner there.
Also you need to add a wait to waif for elements to be clickable / visible before you accessing them, as following.
This should work better:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement