How to scroll a certain element (see the attached image) horizontally within the robot?

I can scroll the window, but is there a way to scroll through a specific element (such as a grid) present in the window? The grid also has a scroll bar similar to a window, as shown in the image below.

I found this solution.

Execute Javascript |  window.document.getElementById("your id goes here").scrollIntoView(true);

But, unfortunately, the "id" in my case is not defined for this particular element (grid) that I want to scroll through. Is there any other solution, I tried a lot, but have not had time yet.

enter image description here

HTML tag for scroll bar enter image description here

+4
source share
1 answer

Use the following

Execute JavaScript | window.document.getElementById('your element id').scrollLeft += 250

(OR)

Execute JavaScript | window.document.getElementsByClassName('your element class name')[0].scrollLeft += 250

(OR)

Execute JavaScript | document.getElementsByName('your element name ')[0].scrollLeft += 250

(OR)

Execute JavaScript | document.getElementsByTagName('your element tagname')[0].scrollLeft += 250

(OR) Execute JavaScript | document.querySelector('your element CSS selector').scrollLeft += 250

, Id querySelector, , .

querySelector , .

scrollIntoView() - scrollLeft - ,

, .

+2

Source: https://habr.com/ru/post/1670287/


All Articles