i using python selenium
i running simple code
driver = webdriver.phantomjs() #also use driver = webdriver.chrome() driver.get("my_url") driver.find_element_by_xpath("//*[@id='lb_loadmore_button_text_2']").click() print [x.text x in driver.find_elements_by_xpath("//font[@class='producttitle']")]
the button clicking 'load more' button. on chrome webdriver see items being loaded, don't know how access them after click committed.
i have tried driver.refresh() before trying print elements
i admittedly fresh selenium , have not been able find solution.
you might need delay after click, let's not add time.sleep()
call, explicitly wait product titles present via presence_of_all_elements_located()
:
from selenium.webdriver.support.ui import webdriverwait selenium.webdriver.support import expected_conditions ec selenium.webdriver.common.by import driver.find_element_by_xpath("//*[@id='lb_loadmore_button_text_2']").click() # waiting wait = webdriverwait(driver, 10) product_titles = wait.until(ec.presence_of_all_elements_located((by.xpath, "//font[@class='producttitle']"))) print [x.text x in product_titles]