Answers for "how to find height of whole html page"

0

how to get height of web page

Dimension initial_size = driver.manage().window().getSize();
    int height = initial_size.getHeight();
    int width = initial_size.getWidth();
Posted by: Guest on February-04-2021
0

how to find total height of single page page in html

function calculateTotalHeightMinusElement(excludeElementClass)
{
  // Get all child elements of the body tag
  var bodyChildren = (document.getElementsByTagName('body')[0]).children;

  var totalHeight = 0;

  // Loop through the selected elements
  for (var i = 0; i < bodyChildren.length; i++) {

    // Add the height of this element
    totalHeight = totalHeight + bodyChildren[i].offsetHeight;
  }

  // Get the height of the element we want to exclude
  var excludedElementHeight = document.getElementsByClassName(excludeElementClass)[0].offsetHeight;

  // Calculate height minus the excluded element
  var finalHeight = totalHeight - excludedElementHeight;

  // Display the final height in an alert
  alert("Total height: " + finalHeight);
}

document.addEventListener("DOMContentLoaded", function(event) {

  // Pass in the class name of the element you want to minus from the height calculation
  calculateTotalHeightMinusElement("myDivClass");
});
Posted by: Guest on February-22-2021
0

how to get height of web page

Dimension initial_size = driver.manage().window().getSize();
    int height = initial_size.getHeight();
    int width = initial_size.getWidth();
Posted by: Guest on February-04-2021
0

how to find total height of single page page in html

function calculateTotalHeightMinusElement(excludeElementClass)
{
  // Get all child elements of the body tag
  var bodyChildren = (document.getElementsByTagName('body')[0]).children;

  var totalHeight = 0;

  // Loop through the selected elements
  for (var i = 0; i < bodyChildren.length; i++) {

    // Add the height of this element
    totalHeight = totalHeight + bodyChildren[i].offsetHeight;
  }

  // Get the height of the element we want to exclude
  var excludedElementHeight = document.getElementsByClassName(excludeElementClass)[0].offsetHeight;

  // Calculate height minus the excluded element
  var finalHeight = totalHeight - excludedElementHeight;

  // Display the final height in an alert
  alert("Total height: " + finalHeight);
}

document.addEventListener("DOMContentLoaded", function(event) {

  // Pass in the class name of the element you want to minus from the height calculation
  calculateTotalHeightMinusElement("myDivClass");
});
Posted by: Guest on February-22-2021

Code answers related to "how to find height of whole html page"

Browse Popular Code Answers by Language