How can I scroll a web page using selenium webdriver in python?

前端 未结 18 2091
孤街浪徒
孤街浪徒 2020-11-22 07:04

I am currently using selenium webdriver to parse through facebook user friends page and extract all ids from the AJAX script. But I need to scroll down to get all the friend

18条回答
  •  自闭症患者
    2020-11-22 07:50

    You can use send_keys to simulate an END (or PAGE_DOWN) key press (which normally scroll the page):

    from selenium.webdriver.common.keys import Keys
    html = driver.find_element_by_tag_name('html')
    html.send_keys(Keys.END)
    

提交回复
热议问题