javascript - Get document height $(document).height() using Python -


i want document height various url, it's suppose jquery equivalent of $(document).height() pages. how should go this?

i comfortable using python , javascript.

if want browser's window size can use.

get_window_size(windowhandle='current')

gets width , height of current window.

usage: driver.get_window_size()

but not same $(document).height(), have asked for, way trigger same javascript command using execute_script.

from selenium import webdriver  driver = webdriver.phantomjs() driver.get("http://google.com") driver.maximize_window() height = driver.execute_script("return document.body.scrollheight") print height 

note: if want execute jquery command, you'll have below.

from selenium import webdriver  driver = webdriver.firefox() driver.get("http://google.com") driver.maximize_window() open('jquery-1.9.1.min.js', 'r') jquery_js:      jquery = jquery_js.read() #read jquery file     driver.execute_script(jquery) #active jquery lib     height = driver.execute_script("return $(document).height()")     print height 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -