Reputation: 451
I used webdriver to login to a website, and I found that the data I wanted to extract is inside an iframe. Like a picture above. At first, I used xpath helper to get me the whole data table.
select_box2 =driver.find_element_by_xpath("//table[@class='k-selectable']/tbody").text
print(select_box2)
But I can only extract 7 datas (Total are 400). Everytime when I scrolled down manually, I can see another part of data, but cannot do the whole at the same time. Any suggestion?
Upvotes: 0
Views: 1132
Reputation: 1835
Recently i did a script to scrape data from instagram
there i need to sroll down the page to load more items
The strategy was:
something like
driver.get(url)
items = driver.find_elements_by_tag_name("li") #get a list of items
q = len(items)
li_text = items[q-1].text.splitlines() #in this case i looking for the penultimate element
li = driver.find_element_by_xpath("//li[contains(.,'"+li_text[1]+"')]") #get the element reference with find_element()
li.location_once_scrolled_into_view #scroll down
Upvotes: 1