Skip to main content

Validate Scrolling Reaches the Bottom of a Page

Validate

functionScrolling browserScroll()Reaches {the scrolltop=Bottom _eval("ds$(window).scrollTop()");of //log("scrolltop:a "+scrolltop);
   innerheight = _eval("window.innerHeight");
   height = _eval("ds$(document).height()");
  log("scrolltop + innerheight :" + Math.round(scrolltop + innerheight));
  log("height:" + height);
  while(Math.round(scrolltop + innerheight)  != height)
     {
        if(scrolltop + innerheight ==height) {
           log("bottom!");
        }
       else{
            _eval("window.scroll(0,40000)");
        }
       scrolltop= _eval("ds$(window).scrollTop()");
      //log("scrolltop : "+scrolltop);
      innerheight= _eval("window.innerHeight");
      height = _eval("ds$(document).height()");
      log("scrolltop + innerheight :" + Math.round(scrolltop + innerheight));
  		log("height:" + height);
    }
}
Page

HaveUse usedthis Math.roundpattern towhen checka Scenario Editor test must confirm that the browser reached the bottom of a page, list, or scrollable container. This is common for wholelazy-loaded numbercontent, asterms somepages, mightinfinite bescroll, inor decimallong soresult lists.

  • Validate a stable element that appears only near the loopbottom.
  • Check willthat golazy-loaded oncontent has finished loading before continuing.
  • Use a container-specific check if the numberspage nothas equal.multiple

    Eg:scrollable scrolltopareas.

  • Avoid +assuming innerheightthat :11960.7939one Vsscroll height:11691action ---always Thisreaches casethe wont match and while loop will gobottom on andevery on.viewport.

So

Validation toworkflow

avoid
  1. Scroll thistoward wethe cantarget doarea.
  2. Wait Math.roundfor tothe getexpected nearestbottom wholemarker, number and then we can stop scrolling.

    Also remember to call this function ' browserScroll' outside either in jsfooter, or infinal DSitem.

  3. Assert IDE as new step using customJS as action- just followingthat the normal javascript execution.

    Another Alternate for scrolling would be to check ifexpected element is visible or not and then based on that scroll can be done until that elementcontent is visible.isVisible

  4. Capture conditionoutput takesif somethe timepage tocontinues check for visibility of element as there are lot of checks inside.So once can also use Element.wasNotFound() method to check for element’s foundloading or notthe directly.target never appears.

Eg: span(“data”).wasNotFound()


Last updated: JuneSeptember 26,9, 20232026

If you have any feedback on this topic, please contact us at documentation@appvance.ai