1

im currently writing an e2e script however, im having issues accessing an element when the a div overflows and scrollbar within the div is being activated.

Inside the form, i need to access the scroll down inside the div of the request travel form.

enter image description here

I tried using:

 browser.executeScript("window.scrollTo(0,10000);").then(callback);

However, the scrollbar that it access is the browser itself not the div i intended to scroll down.

Any leads or suggestion is greatly appreciate.

Thanks!

1 Answer 1

1

I had same issue with my application. There is no direct way using which you can scroll inside scrollbar but I achieved it using javacript executor.

Option 1:-
You can select element till which you wanted to scroll.
example:- (replace with your actual identifier)

browser.executeScript('arguments[0].scrollIntoView(true)', <yourelement>.getWebElement());

Option 2:-
Find the identifier of element on which scrollbar is applied and use below code.

var objDiv = document.getElementById("divExample");
objDiv.scrollTop = objDiv.scrollHeight;

let me know if still facing issue.

Sign up to request clarification or add additional context in comments.

2 Comments

what is the content of the getWebElement()?
getWebElement returns the WebElement represented by this ElementFinder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.