2

I have a text field that I need to scroll to the bottom of in order for the Next button to be activated to click. This project is using Angular 6 my tests are end to end test running on the protractor/cucumber framework.

The textbox is contained within the page and nothing seems to work allowing me to scroll within the text field. I have tried the mouseMove mouseDown options, along with a simple sendKeys End or ArrowDown.
You can find out more details in this screenshot.

Any advice is greatly appreciated.

1

Have you tried simply scrolling to the bottom without any reference to any object:

element(by.className('<any element on page>')).click();//to focus on page first where scroll need to happen
 browser.executeScript('window.scrollTo(0,document.body.scrollHeight)').then(function()
{ //whatever you need to check for here }
);
0

While I haven't used Protractor, generally when I come across an issue like this I use a scrollTo or scrollIntoView() action to bring the viewport into view of the element.

Some cursory research on Protractor shows there are a few examples out there including this one suggesting you wrap the scrollIntoView() action in an executeScript method: https://stackoverflow.com/questions/39399477/protractor-scroll-into-view-not-working#comment66147579_39399892.

So in your case you should be able to locate the Next button within the DOM and then scroll it to within view.

  • 1
    only problem with that is the button is in view, it is disabled until you scroll to the bottom of the terms and conditions text area. Once at the bottom the button is active. My other thought was to alter the DOM. I know how to change the ng-reflect-disabled to false but not removed the disabled at the end or change it to enabled. <button _ngcontent-c30="" class="sub-account-terms__agree mat-raised-button mat-primary" color="primary" id="net_SubAccountAgreeToTerms_btn" mat-raised-button="" ng-reflect-disabled="true" ng-reflect-color="primary" disabled> – Steven Rutherford Jun 30 '18 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.