'Not able to move the scroll bar inside Tag

I have requirement to move the scroll bar in div tag till the end in CodeceptJS

div class name : form-section credit-app-container terms-and-conditions-scrolled

I tried to give the CSS Selector like this. But the scroll bar is not moving till the end [class^="form-section credit-app-container"] *:last-child .form-section credit-app-container terms-and-conditions-scrolled > *:last-child

Here I used the function I.scrollIntoView();

I also did the following things to resolve

1. await I.executeScript(function()
{
      let objDiv = document.querySelector(this.termsAndConditionScrollBar);
      objDiv.scrollTop = objDiv.scrollHeight;
    });

But here I am getting an error 1] Error | javascript error: javascript error: Cannot read properties of null (reading 'scrollHeight') 2.

await I.executeScript(function() {
      $(".terms-and-conditions-scrolled").scrollTo(1000, 1000);
    });

Here I am getting an error that $ is not defined

Please let me know if you need any other details to resolve



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source