How to click on Load More button within Google Trends and print all the titles through Selenium and Python

前端 未结 4 1954
耶瑟儿~
耶瑟儿~ 2020-12-12 02:02

this time I would like to click a button in order to load more real-time searches. Here is the link of the website:

https://trends.google.com/trends/trendingsearches

4条回答
  •  伪装坚强ぢ
    2020-12-12 02:50

    Find it with find_elements_by_css_selector and click on it. I don't think if you need to wait or scroll.

    element = driver.find_elements_by_css_selector("div[ng-click=\"ctrl.loadMoreFeedItems()\"]")
    element.click()
    

    Read this answer, if you wonder why I have not used xPath.

提交回复
热议问题