get height of socument code example

Example 1: javascript get element width

var width = document.getElementById('myID').offsetWidth;//includes margin,border,padding
var height = document.getElementById('myID'). offsetHeight;//includes margin,border,padding

Example 2: javascript get body height

var body = document.body,
    html = document.documentElement;

var height = Math.max( body.scrollHeight, body.offsetHeight, 
                       html.clientHeight, html.scrollHeight, html.offsetHeight );

Example 3: height of page selenium

Dimension initial_size = driver.manage().window().getSize();
    int height = initial_size.getHeight();
    int width = initial_size.getWidth();