"I am fairly new to selenium, i am trying to get all the records on a single page of ebay, but seems like webdriver is only loading half to the instances of the required element, i am using time.sleep and webdriver.wait both to load the complete page but its still showing me only 24 of the records when the actual page has 48, i am also scrolling to the end of the page so all the elements can load but still its only showing me 24 instances, here is my code."
{
# creating a random user agent
ua = UserAgent()
user_agent = ua.random
# setting up browser
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("user-agent={user_agent}")
chrome_options.add_argument("start-maximized")
chrome_options.add_argument('--headless')
# Creating driver
driver = webdriver.Chrome(executable_path="path to chrome driver", chrome_options=chrome_options)
driver.get("https://www.ebay.com/b/Laptops-Netbooks/175672/bn_1648276")
time.sleep(5)
# Scrolling to the end of the page
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
WebDriverWait(driver, 30).until(EC.visibility_of_all_elements_located((By.CLASS_NAME, 's-item')))
# Looking for required elements
req_ele = driver.find_elements_by_class_name("s-item")
for ele in req_ele:
print(ele)
driver.quit()
}
"You can see the actual page has 48 records but this code only prints out 24 selenium objects"