I am looking at this website
https://shopee.sg/search?keyword=cosmetics
and when I search for xpath:
//div[@class="PFM7lj"] It initially only finds 15 elements until I look at each item/scroll down to the end. Then when I search it again, it shows 60 elements found
What do I need to do here?
Additionally when I call the item through BeautifulSoup I get a very different output like this: 
but when I call the 16th item (results[15]), it shows: 
My code so far looks like this:
from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.chrome.options import Options import os chromedriver = "path to chromedriver" options = Options() options.headless = True driver = webdriver.Chrome(chromedriver, options=options) url = "https://shopee.sg/search?keyword=cosmetics" driver.get(url) soup = BeautifulSoup(driver.page_source, 'html.parser') results = soup.find_all('div', {'data-sqe': 'item'}) print(results[14]) print(results[15])
"lazy loading"to display page faster) butBeautifulSoupcan't run JavaScript and you may need Selenium to control real web browser which can run JavaScriptheadless chrome driver? I don't see it in code. Better show minimal working code which we could copy and run. Did you scroll page usingheadless chrome driver? Some server may also detect driver and block it.driver.page_source-seleniumhas some method to move to some element from end of page, or you may need to use JavaScript to scroll it. You should find few questions on Stackoverflow which show it.