does mechanize python library have the ability to wait until javascript has dynamically loaded content before getting the page contents -
i scrape site dynamically loads content using javascript.
i scrape content javascript loads.
i know there ways of getting javascript load (ghost or pywt4 webkit) have not been able pyqt4 installed , recognised ipython installation.
therefore since using requests (and have used mechanize) requests have ability scrape pages content after javascript has finished dynamically loading page content (i.e. divs, img, href, links etc)
as far know, mechanize not support that, there easy way of doing selenium:
from selenium import webdriver driver = webdriver.firefox() driver.get(url) driver.set_window_position(0, 0) driver.set_window_size(100000, 200000) driver.execute_script("window.scrollto(0, document.body.scrollheight);") time.sleep(5) # wait load # print response print driver.page_source
you have install firefox in case.
Comments
Post a Comment